public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48839] New: #error should terminate compilation - similar to missing #include
@ 2011-05-01 15:49 john.salmon at deshaw dot com
  2011-09-25 11:12 ` [Bug preprocessor/48839] " paolo.carlini at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: john.salmon at deshaw dot com @ 2011-05-01 15:49 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: #error should terminate compilation - similar to
                    missing #include
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: john.salmon@deshaw.com


bug 15638 established the policy that a missing #include terminates a
compilation.

I would suggest that encountering an #error should be immediately fatal, in
just the same way, and for exactly the same reasons.

A specific use-case:  I've used something autoconf-like to tell me whether
C++0x-style auto is supported.  Then I write this in my source file:

#ifndef HAVE_CXX0X_AUTO
#error This file requires the auto feature of C++0x
#endif
// lots of code that uses auto.

When I compile it with -std=c++98, I get the initial error message, and then
thousands of lines of complaints about syntax errors in the rest of the file. 
It would be far better to stop after the #error.


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

end of thread, other threads:[~2023-02-23 20:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-01 15:49 [Bug c++/48839] New: #error should terminate compilation - similar to missing #include john.salmon at deshaw dot com
2011-09-25 11:12 ` [Bug preprocessor/48839] " paolo.carlini at oracle dot com
2014-12-22 16:33 ` egall at gwmail dot gwu.edu
2014-12-22 17:35 ` jason at gcc dot gnu.org
2014-12-22 18:52 ` paolo.carlini at oracle dot com
2022-09-23 13:18 ` redi at gcc dot gnu.org
2023-02-23 20:38 ` pinskia at gcc dot gnu.org
2023-02-23 20:45 ` pinskia at gcc dot gnu.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).