From 97dfeb96704e5dbc5bec32ad7b21379d0125e031 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 27 Mar 2016 16:58:38 +0200 Subject: [PATCH] Make some headers C89 safe again - Allows to use FindDirectory.h in C89 sourcecode (no C++ style comments allowed) --- headers/os/kernel/OS.h | 10 +++++----- headers/os/kernel/image.h | 32 +++++++++++++++----------------- headers/os/storage/StorageDefs.h | 22 +++++++++++----------- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/headers/os/kernel/OS.h b/headers/os/kernel/OS.h index 6165bff90d..30a329059f 100644 --- a/headers/os/kernel/OS.h +++ b/headers/os/kernel/OS.h @@ -5,7 +5,7 @@ #ifndef _OS_H #define _OS_H -//! Kernel specific structures and functions +/** Kernel specific structures and functions */ #include #include @@ -87,9 +87,9 @@ typedef struct area_info { #define B_WRITE_AREA 2 #define B_EXECUTE_AREA 4 #define B_STACK_AREA 8 - // "stack" protection is not available on most platforms - it's used - // to only commit memory as needed, and have guard pages at the - // bottom of the stack. + /* "stack" protection is not available on most platforms - it's used + to only commit memory as needed, and have guard pages at the + bottom of the stack. */ extern area_id create_area(const char *name, void **startAddress, uint32 addressSpec, size_t size, uint32 lock, @@ -381,7 +381,7 @@ extern bigtime_t system_time(void); extern nanotime_t system_time_nsecs(void); /* time since booting in nanoseconds */ - // deprecated (is no-op) + /* deprecated (is no-op) */ extern status_t set_timezone(const char *timezone); /* Alarm */ diff --git a/headers/os/kernel/image.h b/headers/os/kernel/image.h index 854e5e8c81..76c748a4df 100644 --- a/headers/os/kernel/image.h +++ b/headers/os/kernel/image.h @@ -34,44 +34,42 @@ typedef struct { int32 text_size; int32 data_size; - // Haiku R1 extensions - int32 api_version; // the Haiku API version used by the image - int32 abi; // the Haiku ABI used by the image + /* Haiku R1 extensions */ + int32 api_version; /* the Haiku API version used by the image */ + int32 abi; /* the Haiku ABI used by the image */ } image_info; -// flags for clear_caches() +/* flags for clear_caches() */ #define B_FLUSH_DCACHE 0x0001 /* data cache */ #define B_FLUSH_ICACHE 0x0004 /* instruction cache */ #define B_INVALIDATE_DCACHE 0x0002 #define B_INVALIDATE_ICACHE 0x0008 -// symbol types +/* symbol types */ #define B_SYMBOL_TYPE_DATA 0x1 #define B_SYMBOL_TYPE_TEXT 0x2 #define B_SYMBOL_TYPE_ANY 0x5 -// initialization/termination functions of shared objects +/* initialization/termination functions of shared objects */ #define B_INIT_BEFORE_FUNCTION_NAME "initialize_before" #define B_INIT_AFTER_FUNCTION_NAME "initialize_after" #define B_TERM_BEFORE_FUNCTION_NAME "terminate_before" #define B_TERM_AFTER_FUNCTION_NAME "terminate_after" #define B_APP_IMAGE_SYMBOL ((void*)(addr_t)0) - // value that can be used instead of a pointer to a symbol in the program - // image. + /* value that can be used instead of a pointer to a symbol in the program + image. */ #define B_CURRENT_IMAGE_SYMBOL ((void*)&__haiku_init_before) - // pointer to a symbol in the callers image + /* pointer to a symbol in the callers image */ -// flags for _kern_load_image() (private API) +/* flags for _kern_load_image() (private API) */ enum { B_WAIT_TILL_LOADED = 0x01, - // Wait till the loader has loaded and relocated - // (but not yet initialized) the application - // image and all dependencies. If not supplied, - // the function returns before the loader - // started to do anything at all, i.e. it - // returns success, even if the executable - // doesn't exist. + /* Wait till the loader has loaded and relocated (but not yet + initialized) the application image and all dependencies. If not + supplied, the function returns before the loader started to do + anything at all, i.e. it returns success, even if the executable + doesn't exist. */ }; #ifdef __cplusplus diff --git a/headers/os/storage/StorageDefs.h b/headers/os/storage/StorageDefs.h index 40c17f5c41..29fae21c04 100644 --- a/headers/os/storage/StorageDefs.h +++ b/headers/os/storage/StorageDefs.h @@ -11,7 +11,7 @@ #include -// Limits +/* Limits */ #define B_DEV_NAME_LENGTH 128 #define B_FILE_NAME_LENGTH NAME_MAX #define B_PATH_NAME_LENGTH MAXPATHLEN @@ -19,17 +19,17 @@ #define B_MIME_TYPE_LENGTH (B_ATTR_NAME_LENGTH - 15) #define B_MAX_SYMLINKS SYMLOOP_MAX -// Open Modes -#define B_READ_ONLY O_RDONLY // read only -#define B_WRITE_ONLY O_WRONLY // write only -#define B_READ_WRITE O_RDWR // read and write +/* Open Modes */ +#define B_READ_ONLY O_RDONLY /* read only */ +#define B_WRITE_ONLY O_WRONLY /* write only */ +#define B_READ_WRITE O_RDWR /* read and write */ -#define B_FAIL_IF_EXISTS O_EXCL // exclusive create -#define B_CREATE_FILE O_CREAT // create the file -#define B_ERASE_FILE O_TRUNC // erase the file's data -#define B_OPEN_AT_END O_APPEND // point to the end of the data +#define B_FAIL_IF_EXISTS O_EXCL /* exclusive create */ +#define B_CREATE_FILE O_CREAT /* create the file */ +#define B_ERASE_FILE O_TRUNC /* erase the file's data */ +#define B_OPEN_AT_END O_APPEND /* point to the end of the data */ -// Node Flavors +/* Node Flavors */ enum node_flavor { B_FILE_NODE = 0x01, B_SYMLINK_NODE = 0x02, @@ -38,4 +38,4 @@ enum node_flavor { }; -#endif // _DEF_STORAGE_H +#endif /* _DEF_STORAGE_H */