public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/59367] New: Syntax error with #pragma message before "else"
@ 2013-12-02 14:55 felix.abecassis at gmail dot com
  2013-12-02 14:56 ` [Bug c/59367] " felix.abecassis at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: felix.abecassis at gmail dot com @ 2013-12-02 14:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59367
           Summary: Syntax error with #pragma message before "else"
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: felix.abecassis at gmail dot com

Using #pragma message before "else" triggers a syntax error:
pragma_message.c: In function 'main':
pragma_message.c:4:9: note: #pragma message: foo
 #pragma message "foo"
         ^
pragma_message.c:5:5: error: 'else' without a previous 'if'
     else {}
     ^
See attached file for source.

Preprocessed .i file:
# 1 "pragma_message.c"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 30 "/usr/include/stdc-predef.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/predefs.h" 1 3 4
# 31 "/usr/include/stdc-predef.h" 2 3 4
# 1 "<command-line>" 2
# 1 "pragma_message.c"
int main()
{
    if (1) {}

# 4 "pragma_message.c"
#pragma message "foo"
# 4 "pragma_message.c"

    else {}
}


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

* [Bug c/59367] Syntax error with #pragma message before "else"
  2013-12-02 14:55 [Bug c/59367] New: Syntax error with #pragma message before "else" felix.abecassis at gmail dot com
@ 2013-12-02 14:56 ` felix.abecassis at gmail dot com
  2013-12-03 14:45 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: felix.abecassis at gmail dot com @ 2013-12-02 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Felix Abecassis <felix.abecassis at gmail dot com> ---
Created attachment 31351
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31351&action=edit
Source file


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

* [Bug c/59367] Syntax error with #pragma message before "else"
  2013-12-02 14:55 [Bug c/59367] New: Syntax error with #pragma message before "else" felix.abecassis at gmail dot com
  2013-12-02 14:56 ` [Bug c/59367] " felix.abecassis at gmail dot com
@ 2013-12-03 14:45 ` mpolacek at gcc dot gnu.org
  2013-12-03 17:56 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-12-03 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-12-03
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.7.4
     Ever confirmed|0                           |1

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed, both cc1/cc1plus.  Goes back at least to 4.6.


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

* [Bug c/59367] Syntax error with #pragma message before "else"
  2013-12-02 14:55 [Bug c/59367] New: Syntax error with #pragma message before "else" felix.abecassis at gmail dot com
  2013-12-02 14:56 ` [Bug c/59367] " felix.abecassis at gmail dot com
  2013-12-03 14:45 ` mpolacek at gcc dot gnu.org
@ 2013-12-03 17:56 ` pinskia at gcc dot gnu.org
  2013-12-03 18:31 ` schwab@linux-m68k.org
  2014-06-12 13:53 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-12-03 17:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think #pragma are being considered a statement which is why you are getting a
parse error.  I almost want to say they are statements based on what I have
read (though I don't have any explicit references to the standard currently).


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

* [Bug c/59367] Syntax error with #pragma message before "else"
  2013-12-02 14:55 [Bug c/59367] New: Syntax error with #pragma message before "else" felix.abecassis at gmail dot com
                   ` (2 preceding siblings ...)
  2013-12-03 17:56 ` pinskia at gcc dot gnu.org
@ 2013-12-03 18:31 ` schwab@linux-m68k.org
  2014-06-12 13:53 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2013-12-03 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> ---
All preprocessing directives are deleted at the end of phase 4.


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

* [Bug c/59367] Syntax error with #pragma message before "else"
  2013-12-02 14:55 [Bug c/59367] New: Syntax error with #pragma message before "else" felix.abecassis at gmail dot com
                   ` (3 preceding siblings ...)
  2013-12-03 18:31 ` schwab@linux-m68k.org
@ 2014-06-12 13:53 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 13:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59367

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.7.4                       |---

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Unsetting target milestone of open non-regression bug from version of branch
being closed.


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

end of thread, other threads:[~2014-06-12 13:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-02 14:55 [Bug c/59367] New: Syntax error with #pragma message before "else" felix.abecassis at gmail dot com
2013-12-02 14:56 ` [Bug c/59367] " felix.abecassis at gmail dot com
2013-12-03 14:45 ` mpolacek at gcc dot gnu.org
2013-12-03 17:56 ` pinskia at gcc dot gnu.org
2013-12-03 18:31 ` schwab@linux-m68k.org
2014-06-12 13:53 ` rguenth 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).