Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Roland McGrath
Tue, 14 Apr 1992 17:28
disabling warnings in dead code
Author: Roland McGrath
Date: Tue, 14 Apr 1992 17:28
Date: Tue, 14 Apr 1992 17:28
17 lines
1160 bytes
1160 bytes
It would be nice to not issue some kinds of warnings for completely dead code.
I have, for example:
if (sizeof (cccc) > 4)
cccc |= cccc << 32;
If CCCC is 32 bits, gcc 2.1 -Wall issues a warning that the shift count is
too large. That's true; the code is wrong. But it will never be executed.
If compiled with sizeof (CCCC) == 8, for example (i.e., cccc is declared
long long instead of long), however, the code will be executed, and it will
be correct.
Since cpp cannot do things like sizeof, there is no way to avoid having the
known-erroneous code presented to the compiler. But gcc does this sort of
optimization well, so the dead statements never actually produce any code,
so using them is fine. Only the warnings are annoying.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads