public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10069: -include switch is improperly handled
@ 2003-03-14  0:06 sean
  0 siblings, 0 replies; 10+ messages in thread
From: sean @ 2003-03-14  0:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10069
>Category:       c++
>Synopsis:       -include switch is improperly handled
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 14 00:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Sean McNeil
>Release:        current CVS
>Organization:
>Environment:
All
>Description:
C++ front end improperly handles the -include switch because it doesn't recognize it as a switch that takes an argument.  The following patch was already posted to gcc@gcc.gnu.org but no response was ever given.

Cheers,
Sean
>How-To-Repeat:
Invoke g++/gcc with a C++ source file and passing "-include some_file.h"
>Fix:
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/g++spec.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 g++spec.c
*** gcc/cp/g++spec.c    10 Mar 2003 23:41:39 -0000      1.36
--- gcc/cp/g++spec.c    13 Mar 2003 23:58:56 -0000
*************** lang_specific_driver (in_argc, in_argv,
*** 174,179 ****
--- 174,180 ----
            }
          else if (((argv[i][2] == '\0'
                     && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1]) != NULL)
+                   || strcmp (argv[i], "-include") == 0
                    || strcmp (argv[i], "-Xlinker") == 0
                    || strcmp (argv[i], "-Tdata") == 0))
            quote = argv[i];
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/10069: -include switch is improperly handled
@ 2003-03-16 10:26 Neil Booth
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Booth @ 2003-03-16 10:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10069; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.co.uk>
To: Sean McNeil <sean@mcneil.com>
Cc: Steven Bosscher <s.bosscher@student.tudelft.nl>, gcc-gnats@gcc.gnu.org,
	gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Subject: Re: c++/10069: -include switch is improperly handled
Date: Sun, 16 Mar 2003 10:19:03 +0000

 Sean McNeil wrote:-
 
 > It would appear that this issue has been addressed somewhere else.  It
 
 Hmm.
 
 > was a bug in how the cc1plus executable handled switches.  That is why I
 > gave the patch to cp/g++spec.c that recognized the switch -include as
 > taking an argument.
 > 
 > I'm not exactly sure how it was addressed.  I'm suspicious that this
 > problem may come back later.  It is peculiar that c++spec.c has to know
 > about switches that take arguments at all.  I'm talking about the check:
 
 If the driver doesn't know what takes arguments, it doesn't know
 reliably where the start and end of a switch is.
 
 > 
 >         else if (((argv[i][2] == '\0'
 >                      && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1])
 > != NULL)
 >                     || strcmp (argv[i], "-Xlinker") == 0
 >                     || strcmp (argv[i], "-Tdata") == 0))
 > 
 > Perhaps the cpp initialization now pulls the -include arguments off the
 > list?
 
 If there is a driver problem it hasn't been worked around in cc1plus.
 
 Neil.


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

* Re: c++/10069: -include switch is improperly handled
@ 2003-03-15 23:56 Sean McNeil
  0 siblings, 0 replies; 10+ messages in thread
From: Sean McNeil @ 2003-03-15 23:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10069; it has been noted by GNATS.

From: Sean McNeil <sean@mcneil.com>
To: Neil Booth <neil@daikokuya.co.uk>
Cc: Steven Bosscher <s.bosscher@student.tudelft.nl>, gcc-gnats@gcc.gnu.org,
   gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Subject: Re: c++/10069: -include switch is improperly handled
Date: 15 Mar 2003 15:54:54 -0800

 It would appear that this issue has been addressed somewhere else.  It
 was a bug in how the cc1plus executable handled switches.  That is why I
 gave the patch to cp/g++spec.c that recognized the switch -include as
 taking an argument.
 
 I'm not exactly sure how it was addressed.  I'm suspicious that this
 problem may come back later.  It is peculiar that c++spec.c has to know
 about switches that take arguments at all.  I'm talking about the check:
 
         else if (((argv[i][2] == '\0'
                      && (char *)strchr ("bBVDUoeTuIYmLiA", argv[i][1])
 != NULL)
                     || strcmp (argv[i], "-Xlinker") == 0
                     || strcmp (argv[i], "-Tdata") == 0))
 
 Perhaps the cpp initialization now pulls the -include arguments off the
 list?
 
 Sean
    
 On Sat, 2003-03-15 at 13:52, Neil Booth wrote:
 > Sean McNeil wrote:-
 > 
 > > No, I am not using PCH.  I'm trying to use the --include switch but it
 > > isn't recognized by C++ as a switch with 2 arguments and so it gets
 > > improperly handled.  It ends up reordering my switches and passes -O2 as
 > > the file to include and tries to compile the include file as an input
 > > file.
 > 
 > By "C++" do you mean the g++ driver?  That may well be a bug.  If so,
 > the place to look is cp/lang-specs.h.
 > 
 > > So I observed that
 > > 
 > > gcc -include hack.h -O2 test.cc
 > > 
 > > would end up as
 > > 
 > > switches:
 > > -include -O2
 > > 
 > > input files:
 > > hack.h test.cc
 > > 
 > > thus it would fail because it cannot find the file "-O2" and because it
 > > would precompile hack.h into hack.pch.
 > 
 > LOL.  Though if you're not using PCH I don't understand your comment.
 > 
 > Neil.
 


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

* Re: c++/10069: -include switch is improperly handled
@ 2003-03-15 21:56 Neil Booth
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Booth @ 2003-03-15 21:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10069; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.co.uk>
To: Sean McNeil <sean@mcneil.com>
Cc: Steven Bosscher <s.bosscher@student.tudelft.nl>, gcc-gnats@gcc.gnu.org,
	gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Subject: Re: c++/10069: -include switch is improperly handled
Date: Sat, 15 Mar 2003 21:52:02 +0000

 Sean McNeil wrote:-
 
 > No, I am not using PCH.  I'm trying to use the --include switch but it
 > isn't recognized by C++ as a switch with 2 arguments and so it gets
 > improperly handled.  It ends up reordering my switches and passes -O2 as
 > the file to include and tries to compile the include file as an input
 > file.
 
 By "C++" do you mean the g++ driver?  That may well be a bug.  If so,
 the place to look is cp/lang-specs.h.
 
 > So I observed that
 > 
 > gcc -include hack.h -O2 test.cc
 > 
 > would end up as
 > 
 > switches:
 > -include -O2
 > 
 > input files:
 > hack.h test.cc
 > 
 > thus it would fail because it cannot find the file "-O2" and because it
 > would precompile hack.h into hack.pch.
 
 LOL.  Though if you're not using PCH I don't understand your comment.
 
 Neil.


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

* Re: c++/10069: -include switch is improperly handled
@ 2003-03-15 21:56 Sean McNeil
  0 siblings, 0 replies; 10+ messages in thread
From: Sean McNeil @ 2003-03-15 21:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10069; it has been noted by GNATS.

From: Sean McNeil <sean@mcneil.com>
To: Neil Booth <neil@daikokuya.co.uk>
Cc: Steven Bosscher <s.bosscher@student.tudelft.nl>, gcc-gnats@gcc.gnu.org,
   gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Subject: Re: c++/10069: -include switch is improperly handled
Date: 15 Mar 2003 13:46:53 -0800

 No, I am not using PCH.  I'm trying to use the --include switch but it
 isn't recognized by C++ as a switch with 2 arguments and so it gets
 improperly handled.  It ends up reordering my switches and passes -O2 as
 the file to include and tries to compile the include file as an input
 file.
 
 So I observed that
 
 gcc -include hack.h -O2 test.cc
 
 would end up as
 
 switches:
 -include -O2
 
 input files:
 hack.h test.cc
 
 thus it would fail because it cannot find the file "-O2" and because it
 would precompile hack.h into hack.pch.
 
 Sean
 
 On Sat, 2003-03-15 at 13:32, Neil Booth wrote:
 > Sean McNeil wrote:-
 > 
 > > I will back out my fix and see if it is still broken.  To summarize, the
 > > following type of command would fail:
 > > 
 > > gcc -include hack.h -O2 file.cc
 > > 
 > > as it would end up taking hack.h as an input file and precompile it into
 > > hack.hcp or something like that.  Further, hack.h wouldn't be included
 > > for use by file.cc
 > > 
 > > I will send you a detailed example if it still fails after I back out
 > > the change.
 > 
 > I make no claims about PCH if that's what you're using.  I have no idea
 > how it works or what it does.
 > 
 > Neil.
 


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

* Re: c++/10069: -include switch is improperly handled
@ 2003-03-15 21:36 Sean McNeil
  0 siblings, 0 replies; 10+ messages in thread
From: Sean McNeil @ 2003-03-15 21:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10069; it has been noted by GNATS.

From: Sean McNeil <sean@mcneil.com>
To: Neil Booth <neil@daikokuya.co.uk>
Cc: Steven Bosscher <s.bosscher@student.tudelft.nl>, gcc-gnats@gcc.gnu.org,
   gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Subject: Re: c++/10069: -include switch is improperly handled
Date: 15 Mar 2003 13:26:37 -0800

 I will back out my fix and see if it is still broken.  To summarize, the
 following type of command would fail:
 
 gcc -include hack.h -O2 file.cc
 
 as it would end up taking hack.h as an input file and precompile it into
 hack.hcp or something like that.  Further, hack.h wouldn't be included
 for use by file.cc
 
 I will send you a detailed example if it still fails after I back out
 the change.
 
 Cheers,
 Sean
 
 On Sat, 2003-03-15 at 13:19, Neil Booth wrote:
 > Sean McNeil wrote:-
 > 
 > > > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10069
 > > > 
 > > > Hi Sean,
 > > > 
 > > > Which version of GCC do you see this bug with?  I don't see this on the 
 > > > 3.3 branch.
 > > > If you saw it on the mainline: there's a lot of ongoing work on the 
 > > > preprocessor, to
 > > > move stuff from cpplib to the front ends.  Maybe it is fixed already.
 > 
 > Nothing was broken that needs fixing, IMO.  I suspect any problems that
 > are being observed are local-setup / configure / something else obscure
 > dependent.  Certainly all my changes aren't fixing anything; they're
 > just putting code where it more properly belongs.
 > 
 > Neil.
 


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

* Re: c++/10069: -include switch is improperly handled
@ 2003-03-15 21:36 Neil Booth
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Booth @ 2003-03-15 21:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10069; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.co.uk>
To: Sean McNeil <sean@mcneil.com>
Cc: Steven Bosscher <s.bosscher@student.tudelft.nl>, gcc-gnats@gcc.gnu.org,
	gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Subject: Re: c++/10069: -include switch is improperly handled
Date: Sat, 15 Mar 2003 21:32:08 +0000

 Sean McNeil wrote:-
 
 > I will back out my fix and see if it is still broken.  To summarize, the
 > following type of command would fail:
 > 
 > gcc -include hack.h -O2 file.cc
 > 
 > as it would end up taking hack.h as an input file and precompile it into
 > hack.hcp or something like that.  Further, hack.h wouldn't be included
 > for use by file.cc
 > 
 > I will send you a detailed example if it still fails after I back out
 > the change.
 
 I make no claims about PCH if that's what you're using.  I have no idea
 how it works or what it does.
 
 Neil.


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

* Re: c++/10069: -include switch is improperly handled
@ 2003-03-15 21:26 Neil Booth
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Booth @ 2003-03-15 21:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10069; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.co.uk>
To: Sean McNeil <sean@mcneil.com>
Cc: Steven Bosscher <s.bosscher@student.tudelft.nl>, gcc-gnats@gcc.gnu.org,
	gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Subject: Re: c++/10069: -include switch is improperly handled
Date: Sat, 15 Mar 2003 21:19:07 +0000

 Sean McNeil wrote:-
 
 > > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10069
 > > 
 > > Hi Sean,
 > > 
 > > Which version of GCC do you see this bug with?  I don't see this on the 
 > > 3.3 branch.
 > > If you saw it on the mainline: there's a lot of ongoing work on the 
 > > preprocessor, to
 > > move stuff from cpplib to the front ends.  Maybe it is fixed already.
 
 Nothing was broken that needs fixing, IMO.  I suspect any problems that
 are being observed are local-setup / configure / something else obscure
 dependent.  Certainly all my changes aren't fixing anything; they're
 just putting code where it more properly belongs.
 
 Neil.


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

* Re: c++/10069: -include switch is improperly handled
@ 2003-03-15 20:26 Sean McNeil
  0 siblings, 0 replies; 10+ messages in thread
From: Sean McNeil @ 2003-03-15 20:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10069; it has been noted by GNATS.

From: Sean McNeil <sean@mcneil.com>
To: Steven Bosscher <s.bosscher@student.tudelft.nl>
Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org,
   gcc-prs@gcc.gnu.org
Subject: Re: c++/10069: -include switch is improperly handled
Date: 15 Mar 2003 12:16:20 -0800

 This problem is in the mainline branch.
 
 Thanks,
 Sean
 
 On Sat, 2003-03-15 at 03:50, Steven Bosscher wrote:
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10069
 > 
 > Hi Sean,
 > 
 > Which version of GCC do you see this bug with?  I don't see this on the 
 > 3.3 branch.
 > If you saw it on the mainline: there's a lot of ongoing work on the 
 > preprocessor, to
 > move stuff from cpplib to the front ends.  Maybe it is fixed already.
 > 
 > Greetz
 > Steven
 > 
 > 
 > 
 > 
 


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

* Re: c++/10069: -include switch is improperly handled
@ 2003-03-15 11:56 Steven Bosscher
  0 siblings, 0 replies; 10+ messages in thread
From: Steven Bosscher @ 2003-03-15 11:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10069; it has been noted by GNATS.

From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org,
	sean@mcneil.com, gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: c++/10069: -include switch is improperly handled
Date: Sat, 15 Mar 2003 12:50:33 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10069
 
 Hi Sean,
 
 Which version of GCC do you see this bug with?  I don't see this on the 
 3.3 branch.
 If you saw it on the mainline: there's a lot of ongoing work on the 
 preprocessor, to
 move stuff from cpplib to the front ends.  Maybe it is fixed already.
 
 Greetz
 Steven
 
 
 
 


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

end of thread, other threads:[~2003-03-16 10:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-14  0:06 c++/10069: -include switch is improperly handled sean
2003-03-15 11:56 Steven Bosscher
2003-03-15 20:26 Sean McNeil
2003-03-15 21:26 Neil Booth
2003-03-15 21:36 Neil Booth
2003-03-15 21:36 Sean McNeil
2003-03-15 21:56 Neil Booth
2003-03-15 21:56 Sean McNeil
2003-03-15 23:56 Sean McNeil
2003-03-16 10:26 Neil Booth

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