By doing these assignments all in a single line, the compiler was fooled into
believing there was some unintentional narrowing happening:
fastgr.c: In function 'new_virtual_edge':
../../lib/common/types.h:592:22: warning: conversion from 'int' to 'short int'
may change value [-Wconversion]
592 | #define ED_weight(e) (((Agedgeinfo_t*)AGDATA(e))->weight)
| ^
fastgr.c:192:55: note: in expansion of macro 'ED_weight'
192 | ED_minlen(e) = ED_count(e) = ED_xpenalty(e) = ED_weight(e) = 1
| ^~~~~~~~~
../../lib/common/types.h:569:21: warning: conversion to 'short unsigned int'
from 'short int' may change the sign of the result [-Wsign-conversion]
569 | #define ED_count(e) (((Agedgeinfo_t*)AGDATA(e))->count)
| ^
fastgr.c:192:24: note: in expansion of macro 'ED_count'
192 | ED_minlen(e) = ED_count(e) = ED_xpenalty(e) = ED_weight(e) = 1
| ^~~~~~~~
We can make it clearer and avoid these warnings by separating the assignments.
if (ED_to_virt(orig) == NULL)
ED_to_virt(orig) = e;
ED_to_orig(e) = orig;
- } else
- ED_minlen(e) = ED_count(e) = ED_xpenalty(e) = ED_weight(e) = 1;
+ } else {
+ ED_weight(e) = 1;
+ ED_xpenalty(e) = 1;
+ ED_count(e) = 1;
+ ED_minlen(e) = 1;
+ }
return e;
}