PATCH: Add missing extern decls on m68k-motorola-sysv (was: Re: m68k problems)

Manfred Hollstein manfred@s-direktnet.de
Sun Jan 10 04:58:00 GMT 1999


On Wed, 6 January 1999, 23:59:50, law@hurl.cygnus.com wrote:

 > 
 >   In message < 13971.30972.220527.356287@saturn.hollstein.net >you write:
 >   > I got the same problem, too.  "fixproto" doesn't add the missing prototypes
 >   > (as Jeff had expected) to <fcntl.h>, because /usr/include/fcntl.h on this
 >   > particular system simply contains:
 >   > 
 >   > /* Some comment */
 >   > 
 >   > #include <sys/fcntl.h>
 >   > 
 >   > Obviously, nothing needs to be fixed, hence fixincludes doesn't leave a
 >   > file "fcntl.h" around, which fixproto then could add missing prototypes
 >   > to
 > Err, I thought fixproto could add prototypes to files independent of what
 > fixincludes does to a file.  Is that not the case?
 > 
 > jeff

Not necessarily.  The function "read_scan_file()" from fix-header
(which in turn is called by fixproto) reads in <fcntl.h>, and, if it
detects nothing needs to be fixed, it simply calls "exit()":


/* fix-header.c, line 712: */
  if (required_unseen_count + partial_count + required_other
#if ADD_MISSING_EXTERN_C
      + missing_extern_C_count
#endif
      == 0)
    {
      if (verbose)
        fprintf (stderr, "%s: OK, nothing needs to be done.\n", inc_filename);
      exit (SUCCESS_EXIT_CODE);
    }


Since no flags are set for the fcntl.h file entry in "std_include_table[]"
(i.e. POSIX1_SYMBOL is 0), the POSIX1 symbols "open", "creat" and "fcntl"
are not considered to be "mandatory":


/* We no longer massage include files for POSIX or XOPEN symbols,
   as there are now several versions of the POSIX and XOPEN standards,
   and it would be a maintenance nightmare for us to track them all.
   Better to be compatible with the system include files.  */
/*#define ADD_MISSING_POSIX 1 */
/*#define ADD_MISSING_XOPEN 1 */

#if ADD_MISSING_POSIX
/* Used to mark names defined in the Posix.1 or Posix.2 standard.  */
#define POSIX1_SYMBOL 2
#define POSIX2_SYMBOL 4
#else
#define POSIX1_SYMBOL 0
#define POSIX2_SYMBOL 0
#endif


BUT, wth is POSIX1_SYMBOL 0 ??? I added definitions for ADD_MISSING_POSIX
and ADD_MISSING_XOPEN for my bloody Motorola systems sometime ago...
OK, looking for their definitions reveals, I added them to the wrong
files :-(  As they are TARGET specific issues, they ought to be defined
in the TARGET specific config files and not in the HOST specific
xm-${name}.h files ...&^%&*^

The small patch below corrects this for my two Motorola systems (m68k and
m88k) verified today by building a cross compiler i586-linux ->
m68k-motorola-sysv and the runtime libraries without any problems.

OK to install?

manfred


1999-01-10  Manfred Hollstein  <manfred@s-direktnet.de>

	* m68k/mot3300.h (ADD_MISSING_POSIX, ADD_MISSING_XOPEN): Define to
	ensure all prototypes necessary for building libio will be available.
	* m68k/xm-mot3300.h (ADD_MISSING_POSIX, ADD_MISSING_XOPEN): Remove
	definitions here as they are not host specific.
	* m88k/sysv3.h, m88k/xm-sysv3.h: Likewise.

diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19990109.orig/gcc/config/m68k/mot3300.h egcs-19990109/gcc/config/m68k/mot3300.h
--- egcs-19990109.orig/gcc/config/m68k/mot3300.h	Sat Dec 19 10:16:50 1998
+++ egcs-19990109/gcc/config/m68k/mot3300.h	Sun Jan 10 13:00:55 1999
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler,
    SysV68 Motorola 3300 Delta Series.
-   Copyright (C) 1987, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1987, 93, 94, 95, 96, 1997, 1998, 1999 Free Software Foundation, Inc.
    Contributed by Abramo and Roberto Bagnara (bagnara@dipisa.di.unipi.it)
    based on Alex Crain's 3B1 definitions.
    Maintained by Philippe De Muyter (phdm@info.ucl.ac.be).
@@ -96,6 +96,10 @@ Boston, MA 02111-1307, USA.  */
 /* size_t is unsigned int.  */
 
 #define SIZE_TYPE "unsigned int"
+
+/* We need POSIX/XOPEN symbols; otherwise building libio will fail.  */
+#define ADD_MISSING_POSIX 1
+#define ADD_MISSING_XOPEN 1
 
 /* Every structure or union's size must be a multiple of 2 bytes.  */
 
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19990109.orig/gcc/config/m68k/xm-mot3300.h egcs-19990109/gcc/config/m68k/xm-mot3300.h
--- egcs-19990109.orig/gcc/config/m68k/xm-mot3300.h	Sat Dec 19 10:17:51 1998
+++ egcs-19990109/gcc/config/m68k/xm-mot3300.h	Sun Jan 10 13:01:11 1999
@@ -1,6 +1,6 @@
 /* Configuration for GNU C-compiler for Motorola 68000 family.
    SysV68 Motorola 3300 Delta Series
-   Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -35,7 +35,3 @@ extern char *alloca ();
 
 #define __PTR_TO_INT(P) ((int)(P))
 #define __INT_TO_PTR(P) ((char *)(P))
-
-/* We need POSIX/XOPEN symbols; otherwise make check will fail.  */
-#define ADD_MISSING_POSIX 1
-#define ADD_MISSING_XOPEN 1
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19990109.orig/gcc/config/m88k/sysv3.h egcs-19990109/gcc/config/m88k/sysv3.h
--- egcs-19990109.orig/gcc/config/m88k/sysv3.h	Sat Dec 19 10:18:08 1998
+++ egcs-19990109/gcc/config/m88k/sysv3.h	Sun Jan 10 13:01:29 1999
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler.
    Motorola m88100 running the AT&T/Unisoft/Motorola V.3 reference port.
-   Copyright (C) 1990, 1991, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1991, 1997, 1999 Free Software Foundation, Inc.
    Contributed by Ray Essick (ressick@mot.com)
    Enhanced by Tom Wood (Tom_Wood@NeXT.com)
 
@@ -43,6 +43,10 @@ Boston, MA 02111-1307, USA.  */
    names other than that.  arul@sdsu.edu says -lg is always needed.  */
 #undef	LIB_SPEC
 #define LIB_SPEC "%{p:-L/lib/libp}%{pg:%{!p:-L/lib/libp}} -lg -lc crtend.o%s"
+
+/* We need POSIX/XOPEN symbols; otherwise building libio will fail.  */
+#define ADD_MISSING_POSIX 1
+#define ADD_MISSING_XOPEN 1
 
 /* Hot version of the profiler that uses r10 to pass the address of
    the counter.  the _gcc_mcount routine knows not to screw with
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19990109.orig/gcc/config/m88k/xm-sysv3.h egcs-19990109/gcc/config/m88k/xm-sysv3.h
--- egcs-19990109.orig/gcc/config/m88k/xm-sysv3.h	Sat Dec 19 10:18:26 1998
+++ egcs-19990109/gcc/config/m88k/xm-sysv3.h	Sun Jan 10 13:01:40 1999
@@ -1,6 +1,6 @@
 /* Configuration for GNU C-compiler.
    Motorola m88100 running the AT&T/Unisoft/Motorola V.3 reference port.
-   Copyright (C) 1990, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1998, 1999 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -26,7 +26,3 @@ Boston, MA 02111-1307, USA.  */
 
 /* for the emacs version of alloca */
 #define STACK_DIRECTION -1
-
-/* We need POSIX/XOPEN symbols; otherwise make check will fail.  */
-#define ADD_MISSING_POSIX 1
-#define ADD_MISSING_XOPEN 1



More information about the Gcc-bugs mailing list