changeset 6873:19d1a55a5de8

Avoid generating C code that some compilers don't accept.
author Bruno Haible <bruno@clisp.org>
date Tue, 27 Jun 2006 15:47:13 +0000
parents ed4106144765
children 8a5ae1656eca
files m4/ChangeLog m4/stdint.m4
diffstat 2 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-27  Bruno Haible  <bruno@clisp.org>
+
+	* stdint.m4 (gl_STDINT_BITSIZEOF): For nonexistent types, set the
+	result to 0, not to empty.
+	Reported by Martin Neitzel <neitzel@sco.gaertner.de>.
+
 2006-06-26  Bruno Haible  <bruno@clisp.org>
 
 	* stdint.m4 (gl_STDINT_H): Test also for <wchar.h>.
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 10
+# stdint.m4 serial 11
 dnl Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -614,10 +614,19 @@
          eval gl_cv_bitsizeof_${gltype}=\$result
         ])
       eval result=\$gl_cv_bitsizeof_${gltype}
-      GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
-      AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
-      eval BITSIZEOF_${GLTYPE}=\$result
+    else
+      dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
+      dnl do a syntax check even on unused #if conditions and give an error
+      dnl on valid C code like this:
+      dnl   #if 0
+      dnl   # if  > 32
+      dnl   # endif
+      dnl   #endif
+      result=0
     fi
+    GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
+    AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
+    eval BITSIZEOF_${GLTYPE}=\$result
   done
   AC_FOREACH([gltype], [$1],
     [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])