From 61ad5bc2e7dd46920db0ae6806fd6ef35fabd33c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 26 Mar 2005 18:01:40 +0000 Subject: [PATCH] Fixed various problems with the latest stdbool.h changes, including stdbool.h itself: - SupportDefs.h only includes stdbool.h if included from C - stdbool.h for C++ now includes a macro for "bool" as defined by that header - stdbool.h does nothing if __bool_true_false_are_defined is already defined - stdbool.h no longer defines a _Bool enum, but defines _Bool as unsigned char, as previously done by SupportDefs.h (the previous version changed the size). - The gensyscalls Jamfile now preprocesses its headers in C++ mode so that "bool" stays "bool", and doesn't become _Bool. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12042 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/support/SupportDefs.h | 52 +++++++++----------------------- headers/posix/stdbool.h | 29 +++++++++++------- src/tools/gensyscalls/Jamfile | 2 +- 3 files changed, 33 insertions(+), 50 deletions(-) diff --git a/headers/os/support/SupportDefs.h b/headers/os/support/SupportDefs.h index cae1ba9b45..f347e5bbc7 100644 --- a/headers/os/support/SupportDefs.h +++ b/headers/os/support/SupportDefs.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2004-2005, Haiku // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -32,7 +32,7 @@ typedef unsigned long ulong; typedef unsigned int uint; typedef unsigned short ushort; -#endif // _SYS_TYPES_H / _SYS_TYPES_H_ +#endif // Standard Includes ----------------------------------------------------------- @@ -40,17 +40,8 @@ typedef unsigned short ushort; // System Includes ------------------------------------------------------------- #include #include -#include #include -// Project Includes ------------------------------------------------------------ - -// Local Includes -------------------------------------------------------------- - -// Local Defines --------------------------------------------------------------- - -// Globals --------------------------------------------------------------------- - // Shorthand type formats ------------------------------------------------------ typedef signed char int8; @@ -106,26 +97,22 @@ extern _IMPEXP_BE const char *B_EMPTY_STRING; #define max_c(a,b) ((a)>(b)?(a):(b)) #ifndef __cplusplus -#ifndef min -#define min(a,b) ((a)>(b)?(b):(a)) -#endif -#ifndef max -#define max(a,b) ((a)>(b)?(a):(b)) -#endif +# ifndef min +# define min(a,b) ((a)>(b)?(b):(a)) +# endif +# ifndef max +# define max(a,b) ((a)>(b)?(a):(b)) +# endif #endif // Grandfathering -------------------------------------------------------------- - -//#ifndef __cplusplus -//typedef enum { false = 0, true = 1 } _Bool; -//#define bool _Bool -//#define false 0 -//#define true 1 -//#endif +#ifndef __cplusplus +# include +#endif #ifndef NULL -#define NULL (0) +# define NULL (0) #endif @@ -160,21 +147,10 @@ extern _IMPEXP_ROOT void * get_stack_frame(void); // use 'true' and 'false' #ifndef FALSE -#define FALSE 0 +# define FALSE 0 #endif #ifndef TRUE -#define TRUE 1 +# define TRUE 1 #endif - -//------------------------------------------------------------------------------ - #endif // _SUPPORT_DEFS_H - -/* - * $Log $ - * - * $Id $ - * - */ - diff --git a/headers/posix/stdbool.h b/headers/posix/stdbool.h index f2af35d419..ec872be326 100644 --- a/headers/posix/stdbool.h +++ b/headers/posix/stdbool.h @@ -1,21 +1,28 @@ -#ifndef _STDBOOL_H_ -#define _STDBOOL_H_ -/* +/* * Copyright 2005, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. -*/ + */ +#ifndef _STDBOOL_H_ +#define _STDBOOL_H_ + +#ifndef __bool_true_false_are_defined #ifndef __cplusplus -typedef enum { false = 0, true = 1 } _Bool; -#define true 1 -#define false 0 +//typedef enum { false = 0, true = 1 } _Bool; + // ToDo: this would change the bool size compared to standard BeOS +typedef unsigned char _Bool; +# define bool _Bool +# define true 1 +# define false 0 #else -typedef bool _Bool; -#define true true -#define false false +# define _Bool bool +# define bool bool +# define true true +# define false false #endif -#define bool _Bool #define __bool_true_false_are_defined 1 +#endif // __bool_true_false_are_defined + #endif /* _STDBOOL_H_ */ diff --git a/src/tools/gensyscalls/Jamfile b/src/tools/gensyscalls/Jamfile index f0dd71ec98..104055ea68 100644 --- a/src/tools/gensyscalls/Jamfile +++ b/src/tools/gensyscalls/Jamfile @@ -131,7 +131,7 @@ rule Preprocess actions Preprocess { - $(CC) -E "$(2)" $(CCFLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ; + $(C++) -xc++ -E "$(2)" $(CCFLAGS) $(CCDEFS) $(CCHDRS) -o "$(1)" ; } Preprocess $(syscallsHeaderPP) : $(syscallsHeader) ;