bug-bison
[Top][All Lists]
Advanced

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

Small bug in BISON 1.28


From: JoergSilkeSchoen
Subject: Small bug in BISON 1.28
Date: Mon, 26 Nov 2001 10:17:19 +0100 (MET)

/*  Suppose you run this file through "bison" V1.28 and then through a 
compiler where 
 *   "__STDC__" is undefined (though it understands "const" 
identifiers). 
 */

%{
/*  This prototype will appear early in the resulting C code and
 *   the "const" will be seen by the compiler.
 */
const char *test(const int *);

%}

%%
/*  A very sophisticated grammar :)  */
everything:
  'h' 'e' 'l' 'l' 'o' ',' 'w' 'o' 'r' 'l' 'd' '!'
  ;

%%

/*  When we reach here, the bison file contained the following lines:

#ifndef __STDC__
#define const
#endif

 *  This removed the "const" in the function definition below and thus 
makes 
 *   the actual function definition incompatible with the prototype!
 *
 *   SUGGESTION/FIX: put the 'ifndef __STDC__' stuff earlier in the 
file. 
 */

const char *test(const int *something)
{
  return(0);
}

/*  Best regards,
 *   Joerg Schoen
 */



reply via email to

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