From 6cb5bcd5f86d168dabf56bfd7d705e99a9072cbb Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Sat, 22 Nov 2003 11:31:12 +0000 Subject: 2003-11-22 Ralf Corsepius * include/rtems/cdefs.h: New. * Makefile.am: Completely reworked. --- cpukit/libcsupport/ChangeLog | 5 + cpukit/libcsupport/Makefile.am | 232 +++++++++++++++++++++++-------- cpukit/libcsupport/include/rtems/cdefs.h | 177 +++++++++++++++++++++++ 3 files changed, 355 insertions(+), 59 deletions(-) create mode 100644 cpukit/libcsupport/include/rtems/cdefs.h (limited to 'cpukit') diff --git a/cpukit/libcsupport/ChangeLog b/cpukit/libcsupport/ChangeLog index 9d25287469..cdba3ec3f9 100644 --- a/cpukit/libcsupport/ChangeLog +++ b/cpukit/libcsupport/ChangeLog @@ -1,3 +1,8 @@ +2003-11-22 Ralf Corsepius + + * include/rtems/cdefs.h: New. + * Makefile.am: Completely reworked. + 2003-11-20 Ralf Corsepius * src/config.h: Remove. diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am index 4043eadf21..b433b56e13 100644 --- a/cpukit/libcsupport/Makefile.am +++ b/cpukit/libcsupport/Makefile.am @@ -7,80 +7,46 @@ include $(top_srcdir)/automake/compile.am include $(top_srcdir)/automake/lib.am include_HEADERS = include/chain.h include/console.h include/clockdrv.h \ - include/iosupp.h include/ringbuf.h include/rtc.h \ - include/spurious.h include/timerdrv.h include/vmeintr.h + include/iosupp.h include/ringbuf.h include/rtc.h include/spurious.h \ + include/timerdrv.h include/vmeintr.h if NEED_STDINT_H -LIBC_HFILES = include/stdint.h +include_HEADERS += include/stdint.h endif if NEED_INTTYPES_H -LIBC_HFILES += include/inttypes.h +include_HEADERS += include/inttypes.h endif -include_HEADERS += $(LIBC_HFILES) - -PREINSTALL_FILES = $(PROJECT_INCLUDE) \ - $(include_HEADERS:include/%=$(PROJECT_INCLUDE)/%) - -$(PROJECT_INCLUDE): - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/motorola: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/rtems: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/sys: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/zilog: - @$(mkinstalldirs) $@ - -$(PROJECT_INCLUDE)/%.h: include/%.h - $(INSTALL_DATA) $< $@ ## motorola include_motoroladir = $(includedir)/motorola -include_motorola_HEADERS = include/motorola/mc68230.h include/motorola/mc68681.h - -PREINSTALL_FILES += $(PROJECT_INCLUDE)/motorola \ - $(include_motorola_HEADERS:include/%=$(PROJECT_INCLUDE)/%) +include_motorola_HEADERS = include/motorola/mc68230.h \ + include/motorola/mc68681.h ## rtems include_rtemsdir = $(includedir)/rtems -include_rtems_HEADERS = \ - include/rtems/assoc.h include/rtems/error.h include/rtems/libcsupport.h \ - include/rtems/libio.h include/rtems/libio_.h \ - include/rtems/termiostypes.h - -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems \ - $(include_rtems_HEADERS:include/%=$(PROJECT_INCLUDE)/%) +include_rtems_HEADERS = include/rtems/assoc.h include/rtems/error.h \ + include/rtems/libcsupport.h include/rtems/libio.h include/rtems/libio_.h \ + include/rtems/termiostypes.h include/rtems/cdefs.h ## sys include_sysdir = $(includedir)/sys +# FIXME: We should not install to include/sys unless using newlib. +include_sys_HEADERS = include/sys/filio.h include/sys/ioccom.h \ + include/sys/ioctl.h include/sys/sockio.h include/sys/ttycom.h + if NEWLIB -NEWLIB_H_FILES = include/sys/termios.h include/sys/utsname.h +include_sys_HEADERS += include/sys/termios.h include/sys/utsname.h endif if NEED_SYS_CDEFS_H -SYS_H_FILES = include/sys/cdefs.h +include_sys_HEADERS += include/sys/cdefs.h endif -# FIXME: We should not install to include/sys unless using newlib. -include_sys_HEADERS = \ -include/sys/filio.h \ -include/sys/ioccom.h \ -include/sys/ioctl.h \ -include/sys/sockio.h \ -include/sys/termios.h \ -include/sys/ttycom.h \ -$(SYS_H_FILES) \ -$(NEWLIB_H_FILES) - -PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys \ - $(include_sys_HEADERS:include/%=$(PROJECT_INCLUDE)/%) - ## zilog include_zilogdir = $(includedir)/zilog @@ -88,9 +54,6 @@ include_zilogdir = $(includedir)/zilog include_zilog_HEADERS = include/zilog/z8036.h include/zilog/z8530.h \ include/zilog/z8536.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/zilog \ - $(include_zilog_HEADERS:include/%=$(PROJECT_INCLUDE)/%) - ## General stuff all-local: $(PREINSTALL_FILES) @@ -124,10 +87,11 @@ DIRECTORY_SCAN_C_FILES = src/opendir.c src/closedir.c src/readdir.c \ src/telldir.c src/getcwd.c ID_C_FILES = src/getegid.c src/geteuid.c src/getgid.c src/getgroups.c \ - src/getlogin.c src/getpgrp.c \ - src/getpid.c src/getppid.c src/getuid.c src/setpgid.c src/setsid.c + src/getlogin.c src/getpgrp.c src/getpid.c src/getppid.c src/getuid.c \ + src/setpgid.c src/setsid.c -MALLOC_C_FILES = src/malloc.c src/mallocfreespace.c src/__brk.c src/__sbrk.c +MALLOC_C_FILES = src/malloc.c src/mallocfreespace.c src/__brk.c \ + src/__sbrk.c PASSWORD_GROUP_C_FILES = src/getpwent.c @@ -142,10 +106,8 @@ UNIX_LIBC_C_FILES = src/unixlibc.c src/hosterr.c BSD_LIBC_C_FILES = src/strlcpy.c src/strlcat.c -COMMON_C_FILES = src/gxx_wrappers.c src/printk.c \ - $(BSD_LIBC_C_FILES) \ - $(BASE_FS_C_FILES) \ - $(MALLOC_C_FILES) $(TERMIOS_C_FILES) $(ERROR_C_FILES) \ +COMMON_C_FILES = src/gxx_wrappers.c src/printk.c $(BSD_LIBC_C_FILES) \ + $(BASE_FS_C_FILES) $(MALLOC_C_FILES) $(TERMIOS_C_FILES) $(ERROR_C_FILES) \ $(ASSOCIATION_C_FILES) UNIX_C_FILES = $(UNIX_LIBC_C_FILES) @@ -181,4 +143,156 @@ DOC_FILES = src/TODO src/CASES EXTRA_DIST = $(DOC_FILES) $(COMMON_C_FILES) $(EMBEDDED_C_FILES) \ $(UNIX_C_FILES) +BUILT_SOURCES = $(PREINSTALL_FILES) + +PREINSTALL_FILES = + +$(PROJECT_INCLUDE)/chain.h: include/chain.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/chain.h + +$(PROJECT_INCLUDE)/console.h: include/console.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/console.h + +$(PROJECT_INCLUDE)/clockdrv.h: include/clockdrv.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/clockdrv.h + +$(PROJECT_INCLUDE)/iosupp.h: include/iosupp.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/iosupp.h + +$(PROJECT_INCLUDE)/ringbuf.h: include/ringbuf.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/ringbuf.h + +$(PROJECT_INCLUDE)/rtc.h: include/rtc.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtc.h + +$(PROJECT_INCLUDE)/spurious.h: include/spurious.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/spurious.h + +$(PROJECT_INCLUDE)/timerdrv.h: include/timerdrv.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/timerdrv.h + +$(PROJECT_INCLUDE)/vmeintr.h: include/vmeintr.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/vmeintr.h + +if NEED_STDINT_H +$(PROJECT_INCLUDE)/stdint.h: include/stdint.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/stdint.h +endif + +if NEED_INTTYPES_H +$(PROJECT_INCLUDE)/inttypes.h: include/inttypes.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/inttypes.h +endif + +$(PROJECT_INCLUDE)/motorola: + @$(mkinstalldirs) $(PROJECT_INCLUDE)/motorola +PREINSTALL_FILES += $(PROJECT_INCLUDE)/motorola + +$(PROJECT_INCLUDE)/motorola/mc68230.h: include/motorola/mc68230.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/motorola/mc68230.h + +$(PROJECT_INCLUDE)/motorola/mc68681.h: include/motorola/mc68681.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/motorola/mc68681.h + +$(PROJECT_INCLUDE)/rtems: + @$(mkinstalldirs) $(PROJECT_INCLUDE)/rtems +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems + +$(PROJECT_INCLUDE)/rtems/assoc.h: include/rtems/assoc.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/assoc.h + +$(PROJECT_INCLUDE)/rtems/error.h: include/rtems/error.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/error.h + +$(PROJECT_INCLUDE)/rtems/libcsupport.h: include/rtems/libcsupport.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/libcsupport.h + +$(PROJECT_INCLUDE)/rtems/libio.h: include/rtems/libio.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/libio.h + +$(PROJECT_INCLUDE)/rtems/libio_.h: include/rtems/libio_.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/libio_.h + +$(PROJECT_INCLUDE)/rtems/termiostypes.h: include/rtems/termiostypes.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/termiostypes.h + +$(PROJECT_INCLUDE)/rtems/cdefs.h: include/rtems/cdefs.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/cdefs.h + +$(PROJECT_INCLUDE)/sys: + @$(mkinstalldirs) $(PROJECT_INCLUDE)/sys +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys + +$(PROJECT_INCLUDE)/sys/filio.h: include/sys/filio.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/filio.h + +$(PROJECT_INCLUDE)/sys/ioccom.h: include/sys/ioccom.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/ioccom.h + +$(PROJECT_INCLUDE)/sys/ioctl.h: include/sys/ioctl.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/ioctl.h + +$(PROJECT_INCLUDE)/sys/sockio.h: include/sys/sockio.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/sockio.h + +$(PROJECT_INCLUDE)/sys/ttycom.h: include/sys/ttycom.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/ttycom.h + +if NEWLIB +$(PROJECT_INCLUDE)/sys/termios.h: include/sys/termios.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/termios.h + +$(PROJECT_INCLUDE)/sys/utsname.h: include/sys/utsname.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/utsname.h +endif + +if NEED_SYS_CDEFS_H +$(PROJECT_INCLUDE)/sys/cdefs.h: include/sys/cdefs.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/cdefs.h +endif + +$(PROJECT_INCLUDE)/zilog: + @$(mkinstalldirs) $(PROJECT_INCLUDE)/zilog +PREINSTALL_FILES += $(PROJECT_INCLUDE)/zilog + +$(PROJECT_INCLUDE)/zilog/z8036.h: include/zilog/z8036.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/zilog/z8036.h + +$(PROJECT_INCLUDE)/zilog/z8530.h: include/zilog/z8530.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/zilog/z8530.h + +$(PROJECT_INCLUDE)/zilog/z8536.h: include/zilog/z8536.h + $(INSTALL_DATA) $< $@ +PREINSTALL_FILES += $(PROJECT_INCLUDE)/zilog/z8536.h + include $(top_srcdir)/automake/local.am diff --git a/cpukit/libcsupport/include/rtems/cdefs.h b/cpukit/libcsupport/include/rtems/cdefs.h new file mode 100644 index 0000000000..d089dc5894 --- /dev/null +++ b/cpukit/libcsupport/include/rtems/cdefs.h @@ -0,0 +1,177 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Berkeley Software Design, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 + * $Id$ + */ + +#ifndef _SYS_CDEFS_H_ +#define _SYS_CDEFS_H_ + +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif + +/* + * The __CONCAT macro is used to concatenate parts of symbol names, e.g. + * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. + * The __CONCAT macro is a bit tricky -- make sure you don't put spaces + * in between its arguments. __CONCAT can also concatenate double-quoted + * strings produced by the __STRING macro, but this only works with ANSI C. + * + * __XSTRING is like __STRING, but it expands any macros in its argument + * first. It is only available with ANSI C. + */ +#if defined(__STDC__) || defined(__cplusplus) +#define __P(protos) protos /* full-blown ANSI C */ +#define __CONCAT1(x,y) x ## y +#define __CONCAT(x,y) __CONCAT1(x,y) +#define __STRING(x) #x /* stringify without expanding x */ +#define __XSTRING(x) __STRING(x) /* expand x, then stringify */ + +#define __const const /* define reserved names to standard */ +#define __signed signed +#define __volatile volatile +#if defined(__cplusplus) +#define __inline inline /* convert to C++ keyword */ +#else +#ifndef __GNUC__ +#define __inline /* delete GCC keyword */ +#endif /* !__GNUC__ */ +#endif /* !__cplusplus */ + +#else /* !(__STDC__ || __cplusplus) */ +#define __P(protos) () /* traditional C preprocessor */ +#define __CONCAT(x,y) x/**/y +#define __STRING(x) "x" + +#ifndef __GNUC__ +#define __const /* delete pseudo-ANSI C keywords */ +#define __inline +#define __signed +#define __volatile +/* + * In non-ANSI C environments, new programs will want ANSI-only C keywords + * deleted from the program and old programs will want them left alone. + * When using a compiler other than gcc, programs using the ANSI C keywords + * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. + * When using "gcc -traditional", we assume that this is the intent; if + * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. + */ +#ifndef NO_ANSI_KEYWORDS +#define const /* delete ANSI C keywords */ +#define inline +#define signed +#define volatile +#endif /* !NO_ANSI_KEYWORDS */ +#endif /* !__GNUC__ */ +#endif /* !(__STDC__ || __cplusplus) */ + +/* + * GCC1 and some versions of GCC2 declare dead (non-returning) and + * pure (no side effects) functions using "volatile" and "const"; + * unfortunately, these then cause warnings under "-ansi -pedantic". + * GCC2.5 uses a new, peculiar __attribute__((attrs)) style. All of + * these work for GNU C++ (modulo a slight glitch in the C++ grammar + * in the distribution version of 2.5.5). + */ +#if __GNUC__ < 2 +#define __dead +#define __dead2 +#define __pure +#define __pure2 +#define __unused +#define __attribute__(x) +#endif +#if __GNUC__ == 2 && __GNUC_MINOR__ < 5 +#define __dead __volatile +#define __dead2 +#define __pure __const +#define __pure2 +#define __unused +#endif +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 +#define __dead +#define __dead2 __attribute__((__noreturn__)) +#define __pure +#define __pure2 __attribute__((__const__)) +#define __unused +#endif +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3 +#define __dead +#define __dead2 __attribute__((__noreturn__)) +#define __pure +#define __pure2 __attribute__((__const__)) +#define __unused __attribute__((__unused__)) +#endif + +#ifdef __GNUC__ +#ifdef __STDC__ +#define __weak_reference(sym,alias) \ + __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ + __asm__(".stabs \"_" #sym "\",1,0,0,0") +#define __warn_references(sym,msg) \ + __asm__(".stabs \"" msg "\",30,0,0,0"); \ + __asm__(".stabs \"_" #sym "\",1,0,0,0") +#else +#define __weak_reference(sym,alias) \ + __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ + __asm__(".stabs \"_/**/sym\",1,0,0,0") +#define __warn_references(sym,msg) \ + __asm__(".stabs msg,30,0,0,0"); \ + __asm__(".stabs \"_/**/sym\",1,0,0,0") +#endif +#endif + +#define __IDSTRING(name,string) \ + static const char name[] __attribute__((__unused__)) = string + +#ifndef __RCSID +#define __RCSID(s) __IDSTRING(rcsid,s) +#endif + +#ifndef __RCSID_SOURCE +#define __RCSID_SOURCE(s) __IDSTRING(rcsid_source,s) +#endif + +#ifndef __COPYRIGHT +#define __COPYRIGHT(s) __IDSTRING(copyright,s) +#endif + +#endif /* !_SYS_CDEFS_H_ */ -- cgit v1.2.3