public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/32271] New: Incorrect warnings in disabled code.
@ 2007-06-10 9:24 pcmoen at gmail dot com
2007-06-10 9:26 ` [Bug preprocessor/32271] " pcmoen at gmail dot com
2007-06-10 9:34 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: pcmoen at gmail dot com @ 2007-06-10 9:24 UTC (permalink / raw)
To: gcc-bugs
The preprocessor will report warnings when there is an unterminated ' or " in a
disabled section.
Example code that triggers two warnings:
**** Code begin ****
#if 0
This shouln"t cause a problem.
This shouln't cause a problem.
#endif
int
main()
{
return 0;
}
**** Code end ****
Output from the preprocessor:
$ cpp-4.2 -v -save-temps bug.cpp
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr
--enable-targets=all --disable-werror --enable-checking=release
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.1 20070528 (prerelease) (Ubuntu 4.2-20070528-0ubuntu2)
/usr/lib/gcc/i486-linux-gnu/4.2.1/cc1plus -E -quiet -v -D_GNU_SOURCE bug.cpp
-mtune=generic -fpch-preprocess
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.2
/usr/include/c++/4.2/i486-linux-gnu
/usr/include/c++/4.2/backward
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.2.1/include
/usr/include
End of search list.
# 1 "bug.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "bug.cpp"
bug.cpp:2:12: warning: missing terminating " character
bug.cpp:3:12: warning: missing terminating ' character
int
main()
{
return 0;
}
--
Summary: Incorrect warnings in disabled code.
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: preprocessor
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pcmoen at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32271
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug preprocessor/32271] Incorrect warnings in disabled code.
2007-06-10 9:24 [Bug preprocessor/32271] New: Incorrect warnings in disabled code pcmoen at gmail dot com
@ 2007-06-10 9:26 ` pcmoen at gmail dot com
2007-06-10 9:34 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pcmoen at gmail dot com @ 2007-06-10 9:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pcmoen at gmail dot com 2007-06-10 09:25 -------
Created an attachment (id=13672)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13672&action=view)
Test case that shows the error.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32271
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug preprocessor/32271] Incorrect warnings in disabled code.
2007-06-10 9:24 [Bug preprocessor/32271] New: Incorrect warnings in disabled code pcmoen at gmail dot com
2007-06-10 9:26 ` [Bug preprocessor/32271] " pcmoen at gmail dot com
@ 2007-06-10 9:34 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-10 9:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-06-10 09:34 -------
Actually the warning is correct as the code is undefined at compile time and
this is documented:
# Do not use @code{#if 0} for comments which are not C code. Use a real
# comment, instead. The interior of @code{#if 0} must consist of complete
# tokens; in particular, single-quote characters must balance.
*** This bug has been marked as a duplicate of 14634 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32271
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-10 9:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-10 9:24 [Bug preprocessor/32271] New: Incorrect warnings in disabled code pcmoen at gmail dot com
2007-06-10 9:26 ` [Bug preprocessor/32271] " pcmoen at gmail dot com
2007-06-10 9:34 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).