public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: General search for symbols...
@ 2003-04-02 15:07 Ilia Dyatchkov
  0 siblings, 0 replies; 12+ messages in thread
From: Ilia Dyatchkov @ 2003-04-02 15:07 UTC (permalink / raw)
  To: xyzzy; +Cc: gcc


>I am trying to port GCC to another machine.
>Given that I have a file <new gcc
>path>/gcc/config/<machine>/<machine>.c, how would I, within any of the
>functions in that file find out if a certain symbol has been defined by
>a "#define" statement in the C source that is being compiled?
>
>E.g., the source file consists of one line:
>#define DEFINED_CONSTANT_2
>
>Note: my call to print_node CRASHES the compiler.
>
>I have tried various versions of:
>
>  if((decl = getdecls()))
>    print_node(stderr,"tree: ",decl,4);  /* this CRASHES!!! */

Try debug_tree(decl);

>
>  for ( ; decl; decl = TREE_CHAIN (decl))
>  {
>    if (TREE_CODE (decl) == IDENTIFIER_NODE)
>    {
>      if(!strcmp(IDENTIFIER_POINTER(decl),"DEFINED_CONSTANT_1"))
>        fprintf(stderr,"DEFINED_CONSTANT_1" found, code 
>%d\n",TREE_CODE(decl));
>      else if(!strcmp(IDENTIFIER_POINTER(decl),"DEFINED_CONSTANT_2"))
>        fprintf(stderr,"DEFINED_CONSTANT_2 found, code
>%d\n",TREE_CODE(decl));
>    }
>  }


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

* Re: General search for symbols...
  2003-04-10 20:03               ` Zack Weinberg
@ 2003-04-10 20:12                 ` Mike Stump
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Stump @ 2003-04-10 20:12 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Joe Buck, gcc, gcc-patches

On Thursday, April 10, 2003, at 12:20 PM, Zack Weinberg wrote:
> What do you think of this revision?  I'm not entirely happy with the
> wording.

I think it looks ok.  If you really want me to nit-pick, maybe I'd say, 
`No longer ships' might be a tad informal or might cause grief for our 
International users?

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

* Re: General search for symbols...
  2003-04-10 19:36             ` Mike Stump
@ 2003-04-10 20:03               ` Zack Weinberg
  2003-04-10 20:12                 ` Mike Stump
  0 siblings, 1 reply; 12+ messages in thread
From: Zack Weinberg @ 2003-04-10 20:03 UTC (permalink / raw)
  To: Mike Stump; +Cc: Joe Buck, gcc, gcc-patches

Mike Stump <mrs@apple.com> writes:

> Ok, I am confused then.  What does the varargs.h header in 3.3 do then:
>
> #ifndef _VARARGS_H
> #define _VARARGS_H
>
> #error "GCC no longer implements <varargs.h>."
> #error "Revise your code to use <stdarg.h>."
>
> #endif

This would be what we call "jumping to conclusions based on the
existence of the file."

What do you think of this revision?  I'm not entirely happy with the
wording.

zw

===================================================================
Index: gcc-3.3/changes.html
--- gcc-3.3/changes.html	21 Mar 2003 09:01:04 -0000	1.22
+++ gcc-3.3/changes.html	10 Apr 2003 19:20:25 -0000
@@ -53,7 +53,10 @@
 
     <li>The <code>-traditional</code> C compiler option has been
         removed.  It was deprecated in 3.1 and 3.2.  (Traditional
-        preprocessing remains available.)</li>
+        preprocessing remains available.)  The
+        <code>&lt;varargs.h&gt;</code> header, used for writing
+	variadic functions in traditional C, still exists but will
+	produce an error message if used.</li>
   </ul>
 
 
===================================================================
Index: gcc-3.4/changes.html
--- gcc-3.4/changes.html	10 Apr 2003 05:33:54 -0000	1.19
+++ gcc-3.4/changes.html	10 Apr 2003 19:20:25 -0000
@@ -22,11 +22,8 @@
     <li>GCC no longer accepts the options <code>-fvolatile</code>,
 	<code>-fvolatile-global</code> and <code>-fvolatile-static</code>.
 	It is unlikely that they worked correctly in any 3.x release.</li>
-    <li>GCC no longer supports the use of <code>&lt;varargs.h&gt;</code>
-        and does not provide this header with the distribution.  Use
-        <code>&lt;stdarg.h&gt;</code> instead.  (This header is primarily
-        useful with traditional mode compilation, which feature was removed
-        in GCC 3.3.)
+    <li>GCC no longer ships <code>&lt;varargs.h&gt;</code>.  Use
+        <code>&lt;stdarg.h&gt;</code> instead.</li>
   </ul>
 
 <h2>General Optimizer Improvements</h2>

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

* Re: General search for symbols...
  2003-04-10  9:37           ` Zack Weinberg
@ 2003-04-10 19:36             ` Mike Stump
  2003-04-10 20:03               ` Zack Weinberg
  0 siblings, 1 reply; 12+ messages in thread
From: Mike Stump @ 2003-04-10 19:36 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Joe Buck, gcc, gcc-patches

On Wednesday, April 9, 2003, at 10:33 PM, Zack Weinberg wrote:
> Joe Buck <jbuck@synopsys.com> writes:
>
>> Zack writes:
>>> Note that as of 3.3 GCC no longer supports <varargs.h>, although 
>>> there
>>> are still vestiges of the old code for it.
>>
>> We should have a mention of that (together with any other deprecated
>> features not already mentioned) on
>>
>> http://gcc.gnu.org/gcc-3.3/changes.html
>
> Done.  (I misspoke; it was only removed in 3.4, although it doesn't
> make a lot of sense to use <varargs.h> with 3.3 which dropped
> -traditional.)

Ok, I am confused then.  What does the varargs.h header in 3.3 do then:

#ifndef _VARARGS_H
#define _VARARGS_H

#error "GCC no longer implements <varargs.h>."
#error "Revise your code to use <stdarg.h>."

#endif

?

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

* Re: General search for symbols...
  2003-04-04 18:51         ` Joe Buck
@ 2003-04-10  9:37           ` Zack Weinberg
  2003-04-10 19:36             ` Mike Stump
  0 siblings, 1 reply; 12+ messages in thread
From: Zack Weinberg @ 2003-04-10  9:37 UTC (permalink / raw)
  To: Joe Buck; +Cc: gcc, gcc-patches

Joe Buck <jbuck@synopsys.com> writes:

> Zack writes:
>> Note that as of 3.3 GCC no longer supports <varargs.h>, although there
>> are still vestiges of the old code for it.
>
> We should have a mention of that (together with any other deprecated
> features not already mentioned) on
>
> http://gcc.gnu.org/gcc-3.3/changes.html 

Done.  (I misspoke; it was only removed in 3.4, although it doesn't
make a lot of sense to use <varargs.h> with 3.3 which dropped
-traditional.)

zw

===================================================================
Index: gcc-3.4/changes.html
--- gcc-3.4/changes.html	6 Apr 2003 15:18:53 -0000	1.18
+++ gcc-3.4/changes.html	10 Apr 2003 05:33:19 -0000
@@ -22,6 +22,11 @@
     <li>GCC no longer accepts the options <code>-fvolatile</code>,
 	<code>-fvolatile-global</code> and <code>-fvolatile-static</code>.
 	It is unlikely that they worked correctly in any 3.x release.</li>
+    <li>GCC no longer supports the use of <code>&lt;varargs.h&gt;</code>
+        and does not provide this header with the distribution.  Use
+        <code>&lt;stdarg.h&gt;</code> instead.  (This header is primarily
+        useful with traditional mode compilation, which feature was removed
+        in GCC 3.3.)
   </ul>
 
 <h2>General Optimizer Improvements</h2>

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

* Re: General search for symbols...
  2003-04-04  2:13     ` Hans-Peter Nilsson
  2003-04-04  9:35       ` Zack Weinberg
@ 2003-04-09  8:43       ` Stephen Biggs
  1 sibling, 0 replies; 12+ messages in thread
From: Stephen Biggs @ 2003-04-09  8:43 UTC (permalink / raw)
  To: GCC list

On Thu, 2003-04-03 at 22:11, Hans-Peter Nilsson wrote:
> On 3 Apr 2003, Stephen Biggs wrote:
> 
> > On Wed, 2003-04-02 at 13:34, Hans-Peter Nilsson wrote:
> > > On 2 Apr 2003, Stephen Biggs wrote:
> > > > I am trying to port GCC to another machine.
> > > >
> > > > Given that I have a file <new gcc
> > > > path>/gcc/config/<machine>/<machine>.c, how would I, within any of the
> > > > functions in that file find out if a certain symbol has been defined by
> > > > a "#define" statement in the C source that is being compiled?
> > >
> > > That's an odd need for a new port.  Care to elaborate; example?
> > > (It might turn out to be a misunderstanding or a need covered
> > > by an existing mechanism, that's mainly why I ask.)
> >
> > Thanks for the reply.
> >
> > E.g., I need to do something different in the assembly output based on
> > whether varargs.h or stdarg.h was included in the C source file.
> 
> Maybe that need is covered by the macro current_function_stdarg.
> See function.h.  That particular macro unfortunately seems not
> documented.  See also other ports.  One or another has probably
> solved the same problem your port has.

Ok... I'll check, thanks for the reply.

> 
> > I
> > thought to check to see if either "_VARARGS_H" or "_STDARG_H" was
> > defined.  I am also going to need this for other things.
> 
> I can't guess what you mean by "other things" so I can't help
> you there.

I wish I could tell you, but I am not at liberty, at this time... Thanks
for the advice.

I believe that if I check to see if the function decl for "va_end"
exists, then this tells me whether I am running stdarg or varargs...

> 
> brgds, H-P
> 
> 



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

* Re: General search for symbols...
  2003-04-04  9:35       ` Zack Weinberg
@ 2003-04-04 18:51         ` Joe Buck
  2003-04-10  9:37           ` Zack Weinberg
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Buck @ 2003-04-04 18:51 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc

Zack writes:
> Note that as of 3.3 GCC no longer supports <varargs.h>, although there
> are still vestiges of the old code for it.

We should have a mention of that (together with any other deprecated
features not already mentioned) on

http://gcc.gnu.org/gcc-3.3/changes.html 


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

* Re: General search for symbols...
  2003-04-04  2:13     ` Hans-Peter Nilsson
@ 2003-04-04  9:35       ` Zack Weinberg
  2003-04-04 18:51         ` Joe Buck
  2003-04-09  8:43       ` Stephen Biggs
  1 sibling, 1 reply; 12+ messages in thread
From: Zack Weinberg @ 2003-04-04  9:35 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Stephen Biggs, GCC list

Hans-Peter Nilsson <hp@bitrange.com> writes:

> On 3 Apr 2003, Stephen Biggs wrote:
>
>> On Wed, 2003-04-02 at 13:34, Hans-Peter Nilsson wrote:
>> > On 2 Apr 2003, Stephen Biggs wrote:
>> > > I am trying to port GCC to another machine.
>> > >
>> > > Given that I have a file <new gcc
>> > > path>/gcc/config/<machine>/<machine>.c, how would I, within any of the
>> > > functions in that file find out if a certain symbol has been defined by
>> > > a "#define" statement in the C source that is being compiled?
>> >
>> > That's an odd need for a new port.  Care to elaborate; example?
>> > (It might turn out to be a misunderstanding or a need covered
>> > by an existing mechanism, that's mainly why I ask.)
>>
>> Thanks for the reply.
>>
>> E.g., I need to do something different in the assembly output based on
>> whether varargs.h or stdarg.h was included in the C source file.
>
> Maybe that need is covered by the macro current_function_stdarg.
> See function.h.  That particular macro unfortunately seems not
> documented.  See also other ports.  One or another has probably
> solved the same problem your port has.

Note that as of 3.3 GCC no longer supports <varargs.h>, although there
are still vestiges of the old code for it.

zw

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

* Re: General search for symbols...
  2003-04-03  7:18   ` Stephen Biggs
@ 2003-04-04  2:13     ` Hans-Peter Nilsson
  2003-04-04  9:35       ` Zack Weinberg
  2003-04-09  8:43       ` Stephen Biggs
  0 siblings, 2 replies; 12+ messages in thread
From: Hans-Peter Nilsson @ 2003-04-04  2:13 UTC (permalink / raw)
  To: Stephen Biggs; +Cc: GCC list

On 3 Apr 2003, Stephen Biggs wrote:

> On Wed, 2003-04-02 at 13:34, Hans-Peter Nilsson wrote:
> > On 2 Apr 2003, Stephen Biggs wrote:
> > > I am trying to port GCC to another machine.
> > >
> > > Given that I have a file <new gcc
> > > path>/gcc/config/<machine>/<machine>.c, how would I, within any of the
> > > functions in that file find out if a certain symbol has been defined by
> > > a "#define" statement in the C source that is being compiled?
> >
> > That's an odd need for a new port.  Care to elaborate; example?
> > (It might turn out to be a misunderstanding or a need covered
> > by an existing mechanism, that's mainly why I ask.)
>
> Thanks for the reply.
>
> E.g., I need to do something different in the assembly output based on
> whether varargs.h or stdarg.h was included in the C source file.

Maybe that need is covered by the macro current_function_stdarg.
See function.h.  That particular macro unfortunately seems not
documented.  See also other ports.  One or another has probably
solved the same problem your port has.

> I
> thought to check to see if either "_VARARGS_H" or "_STDARG_H" was
> defined.  I am also going to need this for other things.

I can't guess what you mean by "other things" so I can't help
you there.

brgds, H-P

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

* Re: General search for symbols...
  2003-04-02 16:22 ` Hans-Peter Nilsson
@ 2003-04-03  7:18   ` Stephen Biggs
  2003-04-04  2:13     ` Hans-Peter Nilsson
  0 siblings, 1 reply; 12+ messages in thread
From: Stephen Biggs @ 2003-04-03  7:18 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: GCC list

On Wed, 2003-04-02 at 13:34, Hans-Peter Nilsson wrote:
> On 2 Apr 2003, Stephen Biggs wrote:
> > I am trying to port GCC to another machine.
> >
> > Given that I have a file <new gcc
> > path>/gcc/config/<machine>/<machine>.c, how would I, within any of the
> > functions in that file find out if a certain symbol has been defined by
> > a "#define" statement in the C source that is being compiled?
> 
> That's an odd need for a new port.  Care to elaborate; example?
> (It might turn out to be a misunderstanding or a need covered
> by an existing mechanism, that's mainly why I ask.)

Thanks for the reply.

E.g., I need to do something different in the assembly output based on
whether varargs.h or stdarg.h was included in the C source file. I
thought to check to see if either "_VARARGS_H" or "_STDARG_H" was
defined.  I am also going to need this for other things.

> 
> brgds, H-P
> 
> 



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

* Re: General search for symbols...
  2003-04-02 14:10 Stephen Biggs
@ 2003-04-02 16:22 ` Hans-Peter Nilsson
  2003-04-03  7:18   ` Stephen Biggs
  0 siblings, 1 reply; 12+ messages in thread
From: Hans-Peter Nilsson @ 2003-04-02 16:22 UTC (permalink / raw)
  To: Stephen Biggs; +Cc: GCC list

On 2 Apr 2003, Stephen Biggs wrote:
> I am trying to port GCC to another machine.
>
> Given that I have a file <new gcc
> path>/gcc/config/<machine>/<machine>.c, how would I, within any of the
> functions in that file find out if a certain symbol has been defined by
> a "#define" statement in the C source that is being compiled?

That's an odd need for a new port.  Care to elaborate; example?
(It might turn out to be a misunderstanding or a need covered
by an existing mechanism, that's mainly why I ask.)

brgds, H-P

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

* General search for symbols...
@ 2003-04-02 14:10 Stephen Biggs
  2003-04-02 16:22 ` Hans-Peter Nilsson
  0 siblings, 1 reply; 12+ messages in thread
From: Stephen Biggs @ 2003-04-02 14:10 UTC (permalink / raw)
  To: GCC list

I am trying to port GCC to another machine.

Given that I have a file <new gcc
path>/gcc/config/<machine>/<machine>.c, how would I, within any of the
functions in that file find out if a certain symbol has been defined by
a "#define" statement in the C source that is being compiled?

E.g., the source file consists of one line:
#define DEFINED_CONSTANT_2

Note: my call to print_node CRASHES the compiler.

I have tried various versions of:

  if((decl = getdecls()))
    print_node(stderr,"tree: ",decl,4);  /* this CRASHES!!! */

  for ( ; decl; decl = TREE_CHAIN (decl))
  {
    if (TREE_CODE (decl) == IDENTIFIER_NODE)
    {
      if(!strcmp(IDENTIFIER_POINTER(decl),"DEFINED_CONSTANT_1"))
        fprintf(stderr,"DEFINED_CONSTANT_1" found, code 
%d\n",TREE_CODE(decl));
      else if(!strcmp(IDENTIFIER_POINTER(decl),"DEFINED_CONSTANT_2"))
        fprintf(stderr,"DEFINED_CONSTANT_2 found, code
%d\n",TREE_CODE(decl));
    }
  }



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

end of thread, other threads:[~2003-04-10 19:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-02 15:07 General search for symbols Ilia Dyatchkov
  -- strict thread matches above, loose matches on Subject: below --
2003-04-02 14:10 Stephen Biggs
2003-04-02 16:22 ` Hans-Peter Nilsson
2003-04-03  7:18   ` Stephen Biggs
2003-04-04  2:13     ` Hans-Peter Nilsson
2003-04-04  9:35       ` Zack Weinberg
2003-04-04 18:51         ` Joe Buck
2003-04-10  9:37           ` Zack Weinberg
2003-04-10 19:36             ` Mike Stump
2003-04-10 20:03               ` Zack Weinberg
2003-04-10 20:12                 ` Mike Stump
2003-04-09  8:43       ` Stephen Biggs

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