public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "john.salmon at deshaw dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/48839] New: #error should terminate compilation - similar to missing #include
Date: Sun, 01 May 2011 15:49:00 -0000	[thread overview]
Message-ID: <bug-48839-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2011-05-01 15:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-01 15:49 john.salmon at deshaw dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-48839-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).