[Bug preprocessor/14634] New: Unterminated literals not diagnosed

jsm28 at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Mar 18 16:34:00 GMT 2004


Unterminated string and character constants are no longer diagnosed when
the preprocessing tokens are not converted to tokens, even with -pedantic
-Wall -Wextra.  This is a regression in quality of implementation.  For
example, the following unportable code is not diagnosed.

#if 0
#error "
'
#endif
#define foo '

Furthermore, this contradicts the cpp documentation.  A previous request
to document these extensions
<http://gcc.gnu.org/ml/gcc-patches/2003-04/msg01855.html>
does not seem to have resulted in any documentation of them, and cpp.texi
still says

# 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.

and

# Neither @samp{#error} nor @samp{#warning} macro-expands its argument.
# Internal whitespace sequences are each replaced with a single space.
# The line must consist of complete tokens.  It is wisest to make the
# argument of these directives be a single string constant; this avoids
# problems with apostrophes and the like.

-- 
           Summary: Unterminated literals not diagnosed
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsm28 at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14634



More information about the Gcc-bugs mailing list