public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23688] New: Compiler does not warn on selected unknown character escapes
@ 2005-09-01 23:05 simon_baldwin at yahoo dot com
  2005-09-01 23:11 ` [Bug preprocessor/23688] " pinskia at gcc dot gnu dot org
  2005-09-01 23:16 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 4+ messages in thread
From: simon_baldwin at yahoo dot com @ 2005-09-01 23:05 UTC (permalink / raw)
  To: gcc-bugs

Given the following short test program:

  const char *s1 = "\%\(\[\{"; // all these are invalid escape sequences
  const char *s2 = "\)\]\}";   // so are these

the compiler warns about the unknown escape sequences in s2 (and everything else
you can come up with), but ignores the particular sequences in s1, even though
they're just as invalid.

>From section 2.13.2, paragraph 3, of the 1998 C++ Standard:

Certain nongraphic characters, the single quote ', the double quote ", the
question mark ?, and the back-slash \, can be represented according to Table 5.
 ... If the character following a backslash is not one of those specified, the
behavior is undefined.

A warning for these four renegade unknown escapes, then, would be useful.

-- 
           Summary: Compiler does not warn on selected unknown character
                    escapes
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simon_baldwin at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/23688] Compiler does not warn on selected unknown character escapes
  2005-09-01 23:05 [Bug c++/23688] New: Compiler does not warn on selected unknown character escapes simon_baldwin at yahoo dot com
@ 2005-09-01 23:11 ` pinskia at gcc dot gnu dot org
  2005-09-01 23:16 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-01 23:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-01 23:11 -------
Hmm, interesting if I add -pedantic, I get the warnings.
And this is not a regression.   A preprocessor person has to comment on why this is.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |preprocessor
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
      Known to fail|                            |2.95.3 3.2.3 3.4.0 4.0.0
                   |                            |4.1.0 3.0.4
   Last reconfirmed|0000-00-00 00:00:00         |2005-09-01 23:11:34
               date|                            |


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/23688] Compiler does not warn on selected unknown character escapes
  2005-09-01 23:05 [Bug c++/23688] New: Compiler does not warn on selected unknown character escapes simon_baldwin at yahoo dot com
  2005-09-01 23:11 ` [Bug preprocessor/23688] " pinskia at gcc dot gnu dot org
@ 2005-09-01 23:16 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-01 23:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-01 23:16 -------
Hmm, the comment in the preprocessor is all of those:
    case '(': case '{': case '[': case '%':
      /* '\(', etc, can be used at the beginning of a line in a long
         string split onto multiple lines with \-newline, to prevent
         Emacs or other text editors from getting confused.  '\%' can
         be used to prevent SCCS from mangling printf format strings.  */



-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/23688] Compiler does not warn on selected unknown character escapes
       [not found] <bug-23688-11271@http.gcc.gnu.org/bugzilla/>
@ 2006-08-18 17:51 ` simon_baldwin at yahoo dot com
  0 siblings, 0 replies; 4+ messages in thread
From: simon_baldwin at yahoo dot com @ 2006-08-18 17:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from simon_baldwin at yahoo dot com  2006-08-18 17:51 -------
Unfortunately, adding -pedantic brings in a grab-bag of other warnings that
aren't currently separable.

What would be useful, I think, is to have unknown escape sequences as its own
-Wmumble option.  That way, it's selectively available without all of the rest
of -pedantic.


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-18 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-01 23:05 [Bug c++/23688] New: Compiler does not warn on selected unknown character escapes simon_baldwin at yahoo dot com
2005-09-01 23:11 ` [Bug preprocessor/23688] " pinskia at gcc dot gnu dot org
2005-09-01 23:16 ` pinskia at gcc dot gnu dot org
     [not found] <bug-23688-11271@http.gcc.gnu.org/bugzilla/>
2006-08-18 17:51 ` simon_baldwin at yahoo dot com

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