You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sys/time_units.h: Work around clang div-by-zero warning
clang emits a warning for this code:
foo.c:1:25: warning: division by zero is undefined [-Wdivision-by-zero]
int i = (10 > 100 ? (20 / (10 / 100)) : (20 * (100 / 10)));
^ ~~~~~~~~~~
The warning is generated for code whose value does not affect the
expression result, but technically it is still 'undefined behavior'.
Work around this warning by checking for a zero divisor and substituting
one to make the compiler happy.
Signed-off-by: Keith Packard <[email protected]>
0 commit comments