Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa/testsuite] avoid 'gamma' function name
@ 2003-09-08 21:11 Michael Elizabeth Chastain
  2003-09-08 21:14 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Elizabeth Chastain @ 2003-09-08 21:11 UTC (permalink / raw)
  To: gdb-patches

This patchlet works around a recent change in gcc HEAD where 'gamma' is
now a reserved identifier, even when 'math.h' is not included.

I've reported this as a regression bug against gcc:

  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12213
  [3.4 regression] warning: conflicting types for builtin-function 'gamma'

I'm pretty sure this is actually a bug in gcc.  A draft of the C9x spec
says that all external library names are reserved, and does not qualify
that by saying that the header file for that name has to be included.
However, the particular name 'gamma' is an obsolete name and not
mentioned in the standard.

However -- the purpose of gdb1250.exp is to test backtracing and
prologue analysis.  It's not to test C library reserved identifiers.
So this patch just avoids the issue.

Testing: tested on native i686-pc-linux-gnu, gcc v2 and v3, dwarf-2 and
stabs+.  Specifically tested with gcc HEAD that thinks 'gamma' is
a reserved identifier.

Okay to commit?

Michael C

===

2003-09-08  Michael Chastain  <mec@shout.net>

	* gdb.base/gdb1250.c: Rename 'gamma' to 'my_gamma'.

Index: gdb.base/gdb1250.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gdb1250.c,v
retrieving revision 1.1
diff -u -r1.1 gdb1250.c
--- gdb.base/gdb1250.c	15 Jul 2003 16:28:21 -0000	1.1
+++ gdb.base/gdb1250.c	8 Sep 2003 21:05:19 -0000
@@ -25,7 +25,11 @@
 
 int global = 0;
 
-void gamma (int *parray)
+/* Foo, gcc thinks 'gamma' is a reserved identifier.
+   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12213
+   I am not interested in testing that point so just avoid the word.
+   -- chastain 2003-09-08. */
+void my_gamma (int *parray)
 {
   return;
 }
@@ -37,7 +41,7 @@
   array [1] = global++;
   array [2] = global++;
   array [3] = global++;
-  gamma (array);
+  my_gamma (array);
   abort ();
 }
 


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

* Re: [rfa/testsuite] avoid 'gamma' function name
  2003-09-08 21:11 [rfa/testsuite] avoid 'gamma' function name Michael Elizabeth Chastain
@ 2003-09-08 21:14 ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2003-09-08 21:14 UTC (permalink / raw)
  To: gdb-patches

On Mon, Sep 08, 2003 at 05:11:57PM -0400, Michael Elizabeth Chastain wrote:
> This patchlet works around a recent change in gcc HEAD where 'gamma' is
> now a reserved identifier, even when 'math.h' is not included.
> 
> I've reported this as a regression bug against gcc:
> 
>   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12213
>   [3.4 regression] warning: conflicting types for builtin-function 'gamma'
> 
> I'm pretty sure this is actually a bug in gcc.  A draft of the C9x spec
> says that all external library names are reserved, and does not qualify
> that by saying that the header file for that name has to be included.
> However, the particular name 'gamma' is an obsolete name and not
> mentioned in the standard.
> 
> However -- the purpose of gdb1250.exp is to test backtracing and
> prologue analysis.  It's not to test C library reserved identifiers.
> So this patch just avoids the issue.
> 
> Testing: tested on native i686-pc-linux-gnu, gcc v2 and v3, dwarf-2 and
> stabs+.  Specifically tested with gcc HEAD that thinks 'gamma' is
> a reserved identifier.
> 
> Okay to commit?

Sounds reasonable to me.  I'm 99.9% sure you're right about the GCC
bug, too - at least if gcc HEAD defaults to gnu99 mode?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: [rfa/testsuite] avoid 'gamma' function name
@ 2003-09-08 21:31 Michael Elizabeth Chastain
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Elizabeth Chastain @ 2003-09-08 21:31 UTC (permalink / raw)
  To: gdb-patches, mec

Committed.

Michael C

===

2003-09-08  Michael Chastain  <mec@shout.net>

	* gdb.base/gdb1250.c: Rename 'gamma' to 'my_gamma'.


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

* Re: [rfa/testsuite] avoid 'gamma' function name
@ 2003-09-08 21:29 Michael Elizabeth Chastain
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Elizabeth Chastain @ 2003-09-08 21:29 UTC (permalink / raw)
  To: drow, gdb-patches

> Sounds reasonable to me.  I'm 99.9% sure you're right about the GCC
> bug, too - at least if gcc HEAD defaults to gnu99 mode?

gcc HEAD -std=c99 compiles my test program with 'gamma'
just fine.  So does gcc HEAD -std=c89, for that matter.

So it looks like the particular name 'gamma' is a gnu extension
and is enabled by default.  Bit my ankle, but easy to deal with.

Michael C


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

end of thread, other threads:[~2003-09-08 21:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-08 21:11 [rfa/testsuite] avoid 'gamma' function name Michael Elizabeth Chastain
2003-09-08 21:14 ` Daniel Jacobowitz
2003-09-08 21:29 Michael Elizabeth Chastain
2003-09-08 21:31 Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox