summaryrefslogtreecommitdiffstats
path: root/usr.bin/yacc
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1997-04-29 03:07:45 +0000
committersteve <steve@FreeBSD.org>1997-04-29 03:07:45 +0000
commitae132dac72503f6db7846e1cb3da7cc629d31e8f (patch)
treef341c571eeea40015a415c64bdda3b3ab2aadf85 /usr.bin/yacc
parenta4d9955380f4f3e907c612f0dc644ff293aa4c6e (diff)
downloadFreeBSD-src-ae132dac72503f6db7846e1cb3da7cc629d31e8f.zip
FreeBSD-src-ae132dac72503f6db7846e1cb3da7cc629d31e8f.tar.gz
#include <stdlib.h> in the C++ case and declare getenv and realloc
in the C case so that we don't have to depend on stdlib.h being present. Submitted by: Bruce Evans <bde@freefall.freebsd.org>
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r--usr.bin/yacc/skeleton.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c
index ba397db..c4f4a5a 100644
--- a/usr.bin/yacc/skeleton.c
+++ b/usr.bin/yacc/skeleton.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: skeleton.c,v 1.12 1997/03/22 01:48:17 bde Exp $
+ * $Id: skeleton.c,v 1.13 1997/04/28 03:36:13 steve Exp $
*/
#ifndef lint
@@ -68,8 +68,18 @@ char *banner[] =
"#define yyclearin (yychar=(YYEMPTY))",
"#define yyerrok (yyerrflag=0)",
"#define YYRECOVERING (yyerrflag!=0)",
+ "#if defined(c_plusplus) || defined(__cplusplus)",
+ /* Declaring standard functions is too painful for C++. */
+ "#include <stdlib.h>",
+ "#else",
+ /* Declare standard functions to avoid depending on <stdlib.h>. */
+ "extern char *getenv();",
+ "extern void *realloc();",
+ "#endif",
+#if 0
"extern int yylex();",
"extern int yyparse();",
+#endif
"static int yygrowstack();",
0
};
OpenPOWER on IntegriCloud