Rtems 4.6.99.3 - cdefs.h

Joel Sherrill joel.sherrill at oarcorp.com
Wed May 3 21:53:35 UTC 2006


Steven Johnson wrote:

>Further to the following email,
>
>it turns out that the only header file installed by rtems that refers to
>cdefs.h is rtems_bsdnet_internal.h
>
>It #include's both 'rtems/cdefs.h' and 'sys/cdefs.h'
>
>  
>
It has been a long time goal to slowly eliminate the various versions of 
cdefs.h or
at least turn them into a .h file used only at build time.

>Why?
>
>I cant see any definitions in rtems/cdefs.h that arent made in
>sys/cdefs.h.  Shouldn't the #include to 'rtems/cdefs.h' be changed to
>'sys/cdefs.h' and then the second (and lower) #include of 'sys/cdefs.h'
>be removed?
>
>If this is done, i don't find any other references to 'rtems/cdefs.h',
>so couldn't it be safely removed?
>
>  
>
I tried to remove the sys/cdefs.h and rtems/cdefs.h from the RTEMS tree and
now know that the newlib sys/cdefs.h is NOT sufficient to build RTEMS.
It is missing at least definitions of  _dead2. 

I have not had a chance to see if the sys/cdefs.h in RTEMS can be eliminated
and keep rtems/cdefs.h.  Having an RTEMS sys/cdefs.h and a newlib 
sys/cdefs.h
is confusing.  At least keeping rtems/cdefs.h would make it obvious it 
is ours.

The long term goal is to eliminate RTEMS using cdefs.h as much as possible
until it is an internal file supporting ported BSD code.

>Attached is a patch which does just this.
>
>Steven Johnson
>
>Steven Johnson wrote:
>
>  
>
>>Hi,
>>
>>Im trying to get my application to build now using 4.6.99.3 and im
>>getting the following conflict:
>>
>>include/rtems/cdefs.h:49:1:error:"__END_DECLS" redefined
>><blah>
>>include/sys/cdefs.h:44:1:error:this is the location of the previous
>>definition
>>
>>Both are part of the RTEMS install, and are not coming from my standard
>>library.
>>
>>Apart from some typographical differences, the nature and contents of
>>each file is identical, so why are there 2 files with the same
>>declarations?  Isnt one redundant?
>>
>>How do I prevent this?
>>
>>Steven
>>
>>
>>
>> 
>>
>>    
>>
>
>  
>
>------------------------------------------------------------------------
>
>diff -Naur rtems-4.6.99.3/cpukit/ChangeLog rtems-4.6.99.3-remove-rtems-cdefs/cpukit/ChangeLog
>--- rtems-4.6.99.3/cpukit/ChangeLog	2006-04-19 08:47:26.000000000 +1100
>+++ rtems-4.6.99.3-remove-rtems-cdefs/cpukit/ChangeLog	2006-05-03 07:17:49.000000000 +1100
>@@ -1,3 +1,9 @@
>+2006-05-03  Steven Johnson <sjohnson at sakuraindustries.com>
>+
>+    * remove last reference to rtems/cdefs.h and remove the 
>+    now redundant rtems/cdefs.h refer to sys/cdefs.h for
>+    its replacement.
>+
> 2006-04-18  Joel Sherrill <joel at OARcorp.com>
> 
>     * aclocal/version.m4: Updated to rtems-4.6.99.3.
>diff -Naur rtems-4.6.99.3/cpukit/libcsupport/include/rtems/cdefs.h rtems-4.6.99.3-remove-rtems-cdefs/cpukit/libcsupport/include/rtems/cdefs.h
>--- rtems-4.6.99.3/cpukit/libcsupport/include/rtems/cdefs.h	2004-12-03 05:04:55.000000000 +1100
>+++ rtems-4.6.99.3-remove-rtems-cdefs/cpukit/libcsupport/include/rtems/cdefs.h	1970-01-01 11:00:00.000000000 +1100
>@@ -1,181 +0,0 @@
>-/**
>- * @file rtems/cdefs.h
>- */
>-
>-/*
>- * 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: cdefs.h,v 1.3 2004/12/02 18:04:55 ralf Exp $
>- */
>-
>-#ifndef	_RTEMS_CDEFS_H_
>-#define	_RTEMS_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 /* !_RTEMS_CDEFS_H_ */
>diff -Naur rtems-4.6.99.3/cpukit/libcsupport/Makefile.am rtems-4.6.99.3-remove-rtems-cdefs/cpukit/libcsupport/Makefile.am
>--- rtems-4.6.99.3/cpukit/libcsupport/Makefile.am	2006-01-12 20:57:42.000000000 +1100
>+++ rtems-4.6.99.3-remove-rtems-cdefs/cpukit/libcsupport/Makefile.am	2006-05-03 07:11:41.000000000 +1100
>@@ -23,7 +23,7 @@
> ## 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 include/rtems/cdefs.h
>+    include/rtems/termiostypes.h
> 
> ## zilog
> 
>diff -Naur rtems-4.6.99.3/cpukit/libcsupport/Makefile.in rtems-4.6.99.3-remove-rtems-cdefs/cpukit/libcsupport/Makefile.in
>--- rtems-4.6.99.3/cpukit/libcsupport/Makefile.in	2006-04-19 14:03:13.000000000 +1100
>+++ rtems-4.6.99.3-remove-rtems-cdefs/cpukit/libcsupport/Makefile.in	2006-05-03 07:13:09.000000000 +1100
>@@ -410,8 +410,7 @@
> 	include/rtc.h include/spurious.h include/timerdrv.h \
> 	include/vmeintr.h 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
>+	include/rtems/libio_.h include/rtems/termiostypes.h 
> include_rtems_motoroladir = $(includedir)/rtems/motorola
> include_rtems_motorola_HEADERS = include/motorola/mc68230.h \
>     include/motorola/mc68681.h
>@@ -483,7 +482,6 @@
> 	$(PROJECT_INCLUDE)/rtems/libio.h \
> 	$(PROJECT_INCLUDE)/rtems/libio_.h \
> 	$(PROJECT_INCLUDE)/rtems/termiostypes.h \
>-	$(PROJECT_INCLUDE)/rtems/cdefs.h \
> 	$(PROJECT_INCLUDE)/rtems/zilog/z8036.h \
> 	$(PROJECT_INCLUDE)/rtems/zilog/z8530.h \
> 	$(PROJECT_INCLUDE)/rtems/zilog/z8536.h
>@@ -2807,9 +2805,6 @@
> $(PROJECT_INCLUDE)/rtems/termiostypes.h: include/rtems/termiostypes.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
> 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/termiostypes.h
> 
>-$(PROJECT_INCLUDE)/rtems/cdefs.h: include/rtems/cdefs.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
>-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/cdefs.h
>-
> $(PROJECT_INCLUDE)/rtems/zilog/$(dirstamp):
> 	@$(mkdir_p) $(PROJECT_INCLUDE)/rtems/zilog
> 	@: > $(PROJECT_INCLUDE)/rtems/zilog/$(dirstamp)
>diff -Naur rtems-4.6.99.3/cpukit/libcsupport/preinstall.am rtems-4.6.99.3-remove-rtems-cdefs/cpukit/libcsupport/preinstall.am
>--- rtems-4.6.99.3/cpukit/libcsupport/preinstall.am	2006-01-14 17:20:35.000000000 +1100
>+++ rtems-4.6.99.3-remove-rtems-cdefs/cpukit/libcsupport/preinstall.am	2006-05-03 07:11:03.000000000 +1100
>@@ -91,10 +91,6 @@
> 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/termiostypes.h
> PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/termiostypes.h
> 
>-$(PROJECT_INCLUDE)/rtems/cdefs.h: include/rtems/cdefs.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
>-	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/cdefs.h
>-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/cdefs.h
>-
> $(PROJECT_INCLUDE)/rtems/zilog/$(dirstamp):
> 	@$(mkdir_p) $(PROJECT_INCLUDE)/rtems/zilog
> 	@: > $(PROJECT_INCLUDE)/rtems/zilog/$(dirstamp)
>diff -Naur rtems-4.6.99.3/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h rtems-4.6.99.3-remove-rtems-cdefs/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
>--- rtems-4.6.99.3/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h	2005-02-03 16:35:38.000000000 +1100
>+++ rtems-4.6.99.3-remove-rtems-cdefs/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h	2006-05-03 07:15:03.000000000 +1100
>@@ -26,7 +26,7 @@
> /* make sure we get the network versions of these */
> #include <machine/types.h>
> #include <machine/param.h>
>-#include <rtems/cdefs.h>
>+#include <sys/cdefs.h>
> 
> #include <sys/time.h>
> 
>@@ -67,8 +67,6 @@
>  * Since we can't have two sys/types.h files, we'll hack around
>  * and copy the contents of the BSD sys/types.h to here....
>  */
>-#include <sys/cdefs.h>
>-
> typedef	u_int64_t	u_quad_t;	/* quads */
> typedef	int64_t		quad_t;
> typedef	quad_t *	qaddr_t;
>  
>




More information about the users mailing list