emacs-pretest-bug
[Top][All Lists]
Advanced

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

compilation errors on Solaris 9 with Sun Studio 10 Compilers


From: Hiroshi Fujishima
Subject: compilation errors on Solaris 9 with Sun Studio 10 Compilers
Date: Mon, 27 Jun 2005 14:56:51 +0900
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (usg-unix-v)

Compilation errors are detected while compiling emacs on Solaris 9 4/04
with Sun Studio 10 Compilers.

% cc -c -DHAVE_CONFIG_H -I. -I../src 
-I/tmp/temporally-working-directory/emacs/lib-src 
-I/tmp/temporally-working-directory/emacs/lib-src/../src  -O 
/tmp/temporally-working-directory/emacs/lib-src/getopt.c
"/usr/include/stdio.h", line 273: identifier redeclared: getopt
        current : function(int, pointer to pointer to char, pointer to char) 
returning int
        previous: function(int, pointer to const pointer to char, pointer to 
const char) returning int : "/usr/include/stdlib.h", line 191
"/usr/include/stdio.h", line 275: identifier redeclared: getsubopt
        current : function(pointer to pointer to char, pointer to pointer to 
char, pointer to pointer to char) returning int
        previous: function(pointer to pointer to char, pointer to const pointer 
to char, pointer to pointer to char) returning int : "/usr/include/stdlib.h", 
line 165
cc: acomp failed for /tmp/temporally-working-directory/emacs/lib-src/getopt.c

lib-src/getopt.c:
      29 #ifdef HAVE_CONFIG_H
      30 # include <config.h>
      31 #endif
      32 
      33 #if !defined __STDC__ || !__STDC__
      34 /* This is a separate conditional since some stdc systems
      35    reject `defined (const)'.  */
      36 # ifndef const
      37 #  define const
      38 # endif
      39 #endif
      40 
      41 #include <stdio.h>

Note that the predefined macro __STDC__ has a value of 0 with the Sun
Studio 10 Compilers.

src/config.h:
     524 /* Define to 1 if you have the <stdlib.h> header file. */
     525 #define HAVE_STDLIB_H 1
    1069 #ifdef HAVE_STDLIB_H
    1070 #include <stdlib.h>
    1071 #endif

/usr/include/stdlib.h:
     191 extern int getopt(int, char *const *, const char *);

/usr/include/stdio.h:
     273 extern int      getopt(int, char *const *, const char *);

The following patch solve the problem.

Index: lib-src/getopt.c
===================================================================
RCS file: /cvsroot/emacs/emacs/lib-src/getopt.c,v
retrieving revision 1.24
diff -u -r1.24 getopt.c
--- lib-src/getopt.c    1 Sep 2003 15:45:03 -0000       1.24
+++ lib-src/getopt.c    27 Jun 2005 05:54:14 -0000
@@ -30,6 +30,7 @@
 # include <config.h>
 #endif
 
+#ifndef __SUNPRO_C
 #if !defined __STDC__ || !__STDC__
 /* This is a separate conditional since some stdc systems
    reject `defined (const)'.  */
@@ -37,6 +38,7 @@
 #  define const
 # endif
 #endif
+#endif
 
 #include <stdio.h>
 
Index: lib-src/getopt1.c
===================================================================
RCS file: /cvsroot/emacs/emacs/lib-src/getopt1.c,v
retrieving revision 1.8
diff -u -r1.8 getopt1.c
--- lib-src/getopt1.c   1 Sep 2003 15:45:03 -0000       1.8
+++ lib-src/getopt1.c   27 Jun 2005 05:54:14 -0000
@@ -27,6 +27,7 @@
 # include "getopt.h"
 #endif
 
+#ifndef __SUNPRO_C
 #if !defined __STDC__ || !__STDC__
 /* This is a separate conditional since some stdc systems
    reject `defined (const)'.  */
@@ -34,6 +35,7 @@
 #define const
 #endif
 #endif
+#endif
 
 #include <stdio.h>

-- 
Hiroshi Fujishima




reply via email to

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