bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in #include guards


From: Akim Demaille
Subject: Re: Bug in #include guards
Date: 02 Oct 2001 18:27:28 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

I'm applying this, thanks.

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * tests/regression.at (Invalid CPP headers): New.
        From Alexander Belopolsky.
        * src/files.c (compute_header_macro): Map non alnum chars to `_'.

2001-10-02  Akim Demaille  <address@hidden>

Index: THANKS
===================================================================
RCS file: /cvsroot/bison/bison/THANKS,v
retrieving revision 1.10.2.4
diff -u -u -r1.10.2.4 THANKS
--- THANKS 2001/10/02 14:48:53 1.10.2.4
+++ THANKS 2001/10/02 16:16:55
@@ -1,24 +1,25 @@
 Bison was originally written by Robert Corbett.  It would not be what
 it is today without the invaluable help of these people:
 
-Akim Demaille          address@hidden
+Akim Demaille           address@hidden
 Albert Chin-A-Young     address@hidden
-Daniel Hagerty         address@hidden
-David J. MacKenzie     address@hidden
-Fabrice Bauzac         address@hidden
-Hans Aberg             address@hidden
-Jesse Thilo            address@hidden
-Jim Meyering           address@hidden
-Juan Manuel Guerrero   address@hidden
-Keith Browne           address@hidden
-Laurent Mascherpa      address@hidden
+Alexander Belopolsky    address@hidden
+Daniel Hagerty          address@hidden
+David J. MacKenzie      address@hidden
+Fabrice Bauzac          address@hidden
+Hans Aberg              address@hidden
+Jesse Thilo             address@hidden
+Jim Meyering            address@hidden
+Juan Manuel Guerrero    address@hidden
+Keith Browne            address@hidden
+Laurent Mascherpa       address@hidden
 Marc Autret             address@hidden
-Neil Booth             address@hidden
-Noah Friedman                  address@hidden
+Neil Booth              address@hidden
+Noah Friedman           address@hidden
 Pascal Bart             address@hidden
-Paul Eggert            address@hidden
-Piotr Gackiewicz       address@hidden
-Richard Stallman       address@hidden
+Paul Eggert             address@hidden
+Piotr Gackiewicz        address@hidden
+Richard Stallman        address@hidden
 Robert Anisko           address@hidden
 Shura                   address@hidden
 
Index: src/files.c
===================================================================
RCS file: /cvsroot/bison/bison/src/files.c,v
retrieving revision 1.51.2.9
diff -u -u -r1.51.2.9 files.c
--- src/files.c 2001/10/02 14:48:53 1.51.2.9
+++ src/files.c 2001/10/02 16:16:55
@@ -94,8 +94,7 @@
 static char *
 compute_header_macro (void)
 {
-  int ite;
-  char *macro_name;
+  char *macro_name, *cp;
 
   if (spec_defines_file)
     macro_name = xstrdup (spec_defines_file);
@@ -109,14 +108,12 @@
       strcat (macro_name, header_extension);
     }
 
-  for (ite = 0; macro_name[ite]; ite++)
-    if (macro_name[ite] == '.')
-      macro_name[ite] = '_';
-    else
-      {
-       if (islower (macro_name[ite]))
-         macro_name[ite] -= ('a' - 'A');
-      }
+  for (cp = macro_name; *cp; ++cp)
+    if (islower (*cp))
+      *cp = toupper (*cp);
+    else if (!isalnum (*cp))
+      *cp = '_';
+
   return macro_name;
 }
 
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.1.2.3
diff -u -u -r1.1.2.3 regression.at
--- tests/regression.at 2001/10/02 15:52:24 1.1.2.3
+++ tests/regression.at 2001/10/02 16:16:55
@@ -107,3 +107,25 @@
 ])
 
 AT_CLEANUP
+
+
+## --------------------- ##
+## Invalid CPP headers.  ##
+## --------------------- ##
+
+AT_SETUP([Invalid CPP headers])
+
+mkdir input
+
+AT_DATA([input/input.y],
+[%%
+dummy:
+])
+
+AT_CHECK([bison --defines input/input.y])
+
+AT_CHECK([sed 1q input/input.tab.h], 0,
+[[#ifndef INPUT_INPUT_TAB_H
+]])
+
+AT_CLEANUP(input)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]