public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25294]  New: Bogus "unterminated comment" error from #pragma comment
@ 2005-12-07 14:41 rich at kastle dot com
  2005-12-07 14:45 ` [Bug c++/25294] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: rich at kastle dot com @ 2005-12-07 14:41 UTC (permalink / raw)
  To: gcc-bugs

OS: Fedora Core 4 (linux 2.6.14)

output of gcc -v:
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--host=i386-redhat-linux
Thread model: posix
gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)

Save the following as example.cc, compile with "g++ example.cc"

====== Cut here
extern "C"
{

#pragma pack(1)  /* Start comment
                    end comment on next line */
}

int main(int argc, char *argv[])
{
     return 0;
}
===== cut

I get "example.cc:1: error: unterminated comment"

When using "-save-temps" or "-E", it doesn't report any error.

I silenced this by ending the comment on the same line as #pragma.


-- 
           Summary: Bogus "unterminated comment" error from #pragma comment
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rich at kastle dot com


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


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

* [Bug c++/25294] [4.0/4.1/4.2 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
@ 2005-12-07 14:45 ` pinskia at gcc dot gnu dot org
  2005-12-07 14:47 ` pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-07 14:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-12-07 14:45 -------
Confirmed a regression from 3.4.0.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
      Known to fail|                            |4.0.0 4.1.0 4.2.0
      Known to work|                            |3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-12-07 14:45:07
               date|                            |
            Summary|Bogus "unterminated comment"|[4.0/4.1/4.2 Regression]
                   |error from #pragma comment  |Bogus "unterminated comment"
                   |                            |error from #pragma comment
   Target Milestone|---                         |4.0.3


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


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

* [Bug c++/25294] [4.0/4.1/4.2 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
  2005-12-07 14:45 ` [Bug c++/25294] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2005-12-07 14:47 ` pinskia at gcc dot gnu dot org
  2005-12-12  3:09 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-07 14:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-12-07 14:47 -------
Another example which shows this is specific to the C++ front-end:
struct f{
#pragma pack(1)  /* Start comment
                    end comment on next line */
};

int main(int argc, char *argv[])
{
     return 0;
}


-- 


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


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

* [Bug c++/25294] [4.0/4.1/4.2 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
  2005-12-07 14:45 ` [Bug c++/25294] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
  2005-12-07 14:47 ` pinskia at gcc dot gnu dot org
@ 2005-12-12  3:09 ` pinskia at gcc dot gnu dot org
  2005-12-13 13:00 ` jakub at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-12  3:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-12-12 03:09 -------
: Search converges between 2004-09-20-161001-trunk (#551) and
2004-09-21-094824-trunk (#552).


Looks like this was caused by:
2004-09-20  Matt Austern <austern@apple.com>
            Zack Weinberg  <zack@codesourcery.com>



-- 


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


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

* [Bug c++/25294] [4.0/4.1/4.2 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
                   ` (2 preceding siblings ...)
  2005-12-12  3:09 ` pinskia at gcc dot gnu dot org
@ 2005-12-13 13:00 ` jakub at gcc dot gnu dot org
  2005-12-19 19:14 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-12-13 13:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2005-12-13 13:00 -------
The problem isn't present on gomp-20050608-branch (where pragma handling has
been revamped).


-- 


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


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

* [Bug c++/25294] [4.0/4.1/4.2 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
                   ` (3 preceding siblings ...)
  2005-12-13 13:00 ` jakub at gcc dot gnu dot org
@ 2005-12-19 19:14 ` mmitchel at gcc dot gnu dot org
  2005-12-20  8:47 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-12-19 19:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mmitchel at gcc dot gnu dot org  2005-12-19 19:14 -------
This needs fixing before release: P1.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug c++/25294] [4.0/4.1/4.2 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
                   ` (4 preceding siblings ...)
  2005-12-19 19:14 ` mmitchel at gcc dot gnu dot org
@ 2005-12-20  8:47 ` mmitchel at gcc dot gnu dot org
  2005-12-29 11:39 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-12-20  8:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from mmitchel at gcc dot gnu dot org  2005-12-20 08:47 -------
The problem is that directives.c:do_pragma says:

          /* Squirrel away the pragma text.  Pragmas are                        
             newline-terminated. */

However, as this example shows, simply saving the entire line is incorrect; we
have not already performed the Phase 3 elimination of comments at this point. 
I don't see any good alternative other than to check for the specific case of a
comment starting on this line, and, if the comment is not ended before the end
of the line, treating the end of the pragma as occurring directly before the
comment, rather than at the end of the line.


-- 


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


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

* [Bug c++/25294] [4.0/4.1/4.2 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
                   ` (5 preceding siblings ...)
  2005-12-20  8:47 ` mmitchel at gcc dot gnu dot org
@ 2005-12-29 11:39 ` jakub at gcc dot gnu dot org
  2005-12-31 23:46 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-12-29 11:39 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |12/msg01898.html
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-12-07 14:45:07         |2005-12-29 11:39:51
               date|                            |


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


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

* [Bug c++/25294] [4.0/4.1/4.2 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
                   ` (6 preceding siblings ...)
  2005-12-29 11:39 ` jakub at gcc dot gnu dot org
@ 2005-12-31 23:46 ` jakub at gcc dot gnu dot org
  2006-01-01  0:01 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-12-31 23:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2005-12-31 23:46 -------
Subject: Bug 25294

Author: jakub
Date: Sat Dec 31 23:45:58 2005
New Revision: 109201

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109201
Log:
        PR c++/25294
        * directives.c (do_pragma): If pragma line ends with multi-line
        block comment, end the saved deferred pragma string before that
        comment.  Handle embedded '\0' chars on the pragma line.

        * gcc.dg/pragma-pack-3.c: New test.
        * g++.dg/parse/pragma3.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/parse/pragma3.C
    trunk/gcc/testsuite/gcc.dg/pragma-pack-3.c
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libcpp/ChangeLog
    trunk/libcpp/directives.c


-- 


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



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

* [Bug c++/25294] [4.0/4.1/4.2 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
                   ` (7 preceding siblings ...)
  2005-12-31 23:46 ` jakub at gcc dot gnu dot org
@ 2006-01-01  0:01 ` jakub at gcc dot gnu dot org
  2006-01-01  0:10 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-01-01  0:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2006-01-01 00:00 -------
Subject: Bug 25294

Author: jakub
Date: Sun Jan  1 00:00:56 2006
New Revision: 109202

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109202
Log:
        PR c++/25294
        * directives.c (do_pragma): If pragma line ends with multi-line
        block comment, end the saved deferred pragma string before that
        comment.  Handle embedded '\0' chars on the pragma line.

        * gcc.dg/pragma-pack-3.c: New test.
        * g++.dg/parse/pragma3.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/parse/pragma3.C
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pragma-pack-3.c
Modified:
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/libcpp/ChangeLog
    branches/gcc-4_1-branch/libcpp/directives.c


-- 


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



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

* [Bug c++/25294] [4.0/4.1/4.2 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
                   ` (8 preceding siblings ...)
  2006-01-01  0:01 ` jakub at gcc dot gnu dot org
@ 2006-01-01  0:10 ` jakub at gcc dot gnu dot org
  2006-01-03 18:49 ` [Bug c++/25294] [4.0 " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-01-01  0:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jakub at gcc dot gnu dot org  2006-01-01 00:10 -------
Fixed with ugly hack in 4.1 and on the trunk, will be hopefully soon replaced
with pragma handling merge from gomp-20050608-branch.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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



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

* [Bug c++/25294] [4.0 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
                   ` (9 preceding siblings ...)
  2006-01-01  0:10 ` jakub at gcc dot gnu dot org
@ 2006-01-03 18:49 ` pinskia at gcc dot gnu dot org
  2006-01-04 12:32 ` jakub at gcc dot gnu dot org
  2006-01-04 12:35 ` jakub at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-03 18:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2006-01-03 18:49 -------
Of course this is not fixed in 4.0.x yet so reopening.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
      Known to fail|4.0.0 4.1.0 4.2.0           |4.0.0
      Known to work|3.4.0                       |3.4.0 4.1.0 4.2.0
         Resolution|FIXED                       |
            Summary|[4.0/4.1/4.2 Regression]    |[4.0 Regression] Bogus
                   |Bogus "unterminated comment"|"unterminated comment" error
                   |error from #pragma comment  |from #pragma comment


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



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

* [Bug c++/25294] [4.0 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
                   ` (10 preceding siblings ...)
  2006-01-03 18:49 ` [Bug c++/25294] [4.0 " pinskia at gcc dot gnu dot org
@ 2006-01-04 12:32 ` jakub at gcc dot gnu dot org
  2006-01-04 12:35 ` jakub at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-01-04 12:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jakub at gcc dot gnu dot org  2006-01-04 12:32 -------
Subject: Bug 25294

Author: jakub
Date: Wed Jan  4 12:31:59 2006
New Revision: 109329

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109329
Log:
        PR c++/25294
        * directives.c (do_pragma): If pragma line ends with multi-line
        block comment, end the saved deferred pragma string before that
        comment.  Handle embedded '\0' chars on the pragma line.

        * gcc.dg/pragma-pack-3.c: New test.
        * g++.dg/parse/pragma3.C: New test.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/parse/pragma3.C
    branches/gcc-4_0-branch/gcc/testsuite/gcc.dg/pragma-pack-3.c
Modified:
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_0-branch/libcpp/ChangeLog
    branches/gcc-4_0-branch/libcpp/directives.c


-- 


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



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

* [Bug c++/25294] [4.0 Regression] Bogus "unterminated comment" error from #pragma comment
  2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
                   ` (11 preceding siblings ...)
  2006-01-04 12:32 ` jakub at gcc dot gnu dot org
@ 2006-01-04 12:35 ` jakub at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-01-04 12:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jakub at gcc dot gnu dot org  2006-01-04 12:35 -------
Fixed even on 4.0 branch.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


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



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

end of thread, other threads:[~2006-01-04 12:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-07 14:41 [Bug c++/25294] New: Bogus "unterminated comment" error from #pragma comment rich at kastle dot com
2005-12-07 14:45 ` [Bug c++/25294] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2005-12-07 14:47 ` pinskia at gcc dot gnu dot org
2005-12-12  3:09 ` pinskia at gcc dot gnu dot org
2005-12-13 13:00 ` jakub at gcc dot gnu dot org
2005-12-19 19:14 ` mmitchel at gcc dot gnu dot org
2005-12-20  8:47 ` mmitchel at gcc dot gnu dot org
2005-12-29 11:39 ` jakub at gcc dot gnu dot org
2005-12-31 23:46 ` jakub at gcc dot gnu dot org
2006-01-01  0:01 ` jakub at gcc dot gnu dot org
2006-01-01  0:10 ` jakub at gcc dot gnu dot org
2006-01-03 18:49 ` [Bug c++/25294] [4.0 " pinskia at gcc dot gnu dot org
2006-01-04 12:32 ` jakub at gcc dot gnu dot org
2006-01-04 12:35 ` jakub at gcc dot gnu dot 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).