[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Compiling bison with non-GCC compilers
From: |
Albert Chin-A-Young |
Subject: |
Compiling bison with non-GCC compilers |
Date: |
Mon, 17 Sep 2001 20:30:02 -0500 |
User-agent: |
Mutt/1.2.5i |
1. Non-GCC compilers don't have __attribute__
2. Don't assume __STDC__ is defined to 1. Just test if it is defined.
3. #include "system.h" in src/complain.c to get redefinition of
__attribute__.
4. Variable 'n' unused in src/reduce.c
With these patches, bison 1.29 compiles with the vendor compilers for
Solaris 2.x, IRIX 6.x, Tru64 UNIX 4.0D, 5.x, AIX 4.3.2, and HP-UX
10.20, 11.00.
--
albert chin (address@hidden)
-- snip snip
--- src/system.h.orig Mon Sep 17 19:41:39 2001
+++ src/system.h Mon Sep 17 19:45:46 2001
@@ -99,7 +99,8 @@
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
+# if !defined (__GNUC__) || __GNUC__ < 2 || \
+(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
# endif
/* The __-protected variants of `format' and `printf' attributes
--- src/complain.h.orig Mon Sep 17 19:43:28 2001
+++ src/complain.h Mon Sep 17 19:44:13 2001
@@ -23,7 +23,7 @@
extern "C" {
#endif
-#if defined (__STDC__) && __STDC__
+#ifdef __STDC__
/* Informative messages, but we proceed. */
--- src/complain.c.orig Mon Sep 17 19:44:20 2001
+++ src/complain.c Mon Sep 17 19:55:03 2001
@@ -19,14 +19,10 @@
/* Based on error.c and error.h,
written by David MacKenzie <address@hidden>. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
+#include "system.h"
#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
-# if __STDC__
+# ifdef __STDC__
# include <stdarg.h>
# define VA_START(args, lastarg) va_start(args, lastarg)
# else
@@ -119,7 +115,7 @@
`--------------------------------*/
void
-#if defined VA_START && __STDC__
+#if defined VA_START && defined (__STDC__)
warn (const char *message, ...)
#else
warn (message, va_alist)
@@ -171,7 +167,7 @@
`-----------------------------------------------------------*/
void
-#if defined VA_START && __STDC__
+#if defined VA_START && defined (__STDC__)
complain (const char *message, ...)
#else
complain (message, va_alist)
@@ -221,7 +217,7 @@
`-------------------------------------------------*/
void
-#if defined VA_START && __STDC__
+#if defined VA_START && defined (__STDC__)
fatal (const char *message, ...)
#else
fatal (message, va_alist)
@@ -259,7 +255,7 @@
`------------------------------------------------------------------*/
void
-#if defined VA_START && __STDC__
+#if defined VA_START && defined (__STDC__)
error (int status, int errnum,
const char *message, ...)
#else
--- src/reduce.c.orig Mon Sep 17 20:07:09 2001
+++ src/reduce.c Mon Sep 17 20:19:25 2001
@@ -117,7 +117,7 @@
useless_nonterminals (void)
{
BSet Np, Ns;
- int i, n;
+ int i;
/* N is set as built. Np is set being built this iteration. P is
set of all productions which have a RHS all in N. */
@@ -140,7 +140,6 @@
saved to be used when finding useful productions: only
productions in this set will appear in the final grammar. */
- n = 0;
while (1)
{
for (i = WORDSIZE (nvars) - 1; i >= 0; i--)
@@ -171,7 +170,7 @@
inaccessable_symbols (void)
{
BSet Vp, Vs, Pp;
- int i, n;
+ int i;
short t;
rule r;
@@ -207,7 +206,6 @@
SETBIT (V, start_symbol);
- n = 0;
while (1)
{
for (i = WORDSIZE (nsyms) - 1; i >= 0; i--)
- Compiling bison with non-GCC compilers,
Albert Chin-A-Young <=