Hi Paul, > Le 24 oct. 2018 à 00:27, Paul Eggert <egg...@cs.ucla.edu> a écrit : > > On 10/23/18 8:23 AM, Akim Demaille wrote: >> Fighting warnings is a nightmare. >> Incredibly time consuming. > > You have to pick your battles. I shut off warnings that are more trouble than > they're worth. This particular warning, though, is worthwhile as the program > can have undefined behavior.
Yes, I agree. But ICC is incredibly picky on code generated by Flex 2.5.35. That’s the warnings that are currently annoying me. And ICC’s documentation about pragma is quite unclear, so I don’t know yet what’s the cleanest/simplest way to avoid this. (see below too) > examples/calc++/scanner.cc(928): error #2259: non-pointer conversion from > "flex_int32_t={int}" to "YY_CHAR={unsigned char}" may lose significant bits > register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; > ^ > > examples/calc++/scanner.cc(938): error #2259: non-pointer conversion from > "flex_int32_t={int}" to "YY_CHAR={unsigned char}" may lose significant bits > yy_c = yy_meta[(unsigned int) yy_c]; > ^ > > examples/calc++/scanner.cc(951): error #1682: implicit conversion of a 64-bit > integral type to a smaller integral type (potential portability problem) > YY_DO_BEFORE_ACTION; > ^ > > examples/calc++/scanner.cc(1263): error #1682: implicit conversion of a > 64-bit integral type to a smaller integral type (potential portability > problem) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move > - 1; > ^ > > examples/calc++/scanner.cc(1276): error #1682: implicit conversion of a > 64-bit integral type to a smaller integral type (potential portability > problem) > int new_size = b->yy_buf_size * 2; > ^ > > examples/calc++/scanner.cc(1297): error #1682: implicit conversion of a > 64-bit integral type to a smaller integral type (potential portability > problem) > num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - > ^ > > examples/calc++/scanner.cc(1306): error #1682: implicit conversion of a > 64-bit integral type to a smaller integral type (potential portability > problem) > YY_INPUT( > (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), > ^ > > examples/calc++/scanner.cc(1306): error #1682: implicit conversion of a > 64-bit integral type to a smaller integral type (potential portability > problem) > YY_INPUT( > (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), > ^ > > examples/calc++/scanner.cc(1367): error #2259: non-pointer conversion from > "flex_int32_t={int}" to "YY_CHAR={unsigned char}" may lose significant bits > register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : > 1); > ^ > > examples/calc++/scanner.cc(1377): error #2259: non-pointer conversion from > "flex_int32_t={int}" to "YY_CHAR={unsigned char}" may lose significant bits > yy_c = yy_meta[(unsigned int) yy_c]; > ^ > > examples/calc++/scanner.cc(1410): error #2259: non-pointer conversion from > "flex_int32_t={int}" to "YY_CHAR={unsigned char}" may lose significant bits > yy_c = yy_meta[(unsigned int) yy_c]; > ^ > > examples/calc++/scanner.cc(1814): error #1682: implicit conversion of a > 64-bit integral type to a smaller integral type (potential portability > problem) > num_to_alloc = (yy_buffer_stack_max) + grow_size; > ^ > > examples/calc++/scanner.cc(1854): error #1682: implicit conversion of a > 64-bit integral type to a smaller integral type (potential portability > problem) > b->yy_n_chars = b->yy_buf_size; > ^ > > examples/calc++/scanner.cc(1878): error #1682: implicit conversion of a > 64-bit integral type to a smaller integral type (potential portability > problem) > return yy_scan_bytes(yystr,strlen(yystr) ); > ^ Sometimes ICC’s warnings don’t make sense to me. For instance: > src/muscle-tab.c(413): warning #3179: deprecated conversion of string literal > to char* (should be const char*) > char const *fmt = !eq && value && *value ? "%%define %s %s" : "%%define > %s"; > ^ > > src/muscle-tab.c(497): warning #188: enumerated type mixed with another type > muscle_percent_define_how how_old = atoi (muscle_find_const > (how_name)); > ^ > > src/muscle-tab.c(529): warning #3179: deprecated conversion of string literal > to char* (should be const char*) > char const *val = value ? "" : "false"; > ^ > > src/muscle-tab.c(707): warning #188: enumerated type mixed with another type > complain_indent (&loc, complaint | no_caret | silent, &i, > ^ And > @@.c(966): error #2259: non-pointer conversion from "int" to > "yybool={unsigned char}" may lose significant bits > return yyaction == 0; > ^ etc.