Make some headers C89 safe again

- Allows to use FindDirectory.h in C89 sourcecode (no C++ style comments
  allowed)
This commit is contained in:
Adrien Destugues
2016-03-27 16:58:38 +02:00
parent af6cb5f94e
commit 97dfeb9670
3 changed files with 31 additions and 33 deletions
+5 -5
View File
@@ -5,7 +5,7 @@
#ifndef _OS_H #ifndef _OS_H
#define _OS_H #define _OS_H
//! Kernel specific structures and functions /** Kernel specific structures and functions */
#include <pthread.h> #include <pthread.h>
#include <stdarg.h> #include <stdarg.h>
@@ -87,9 +87,9 @@ typedef struct area_info {
#define B_WRITE_AREA 2 #define B_WRITE_AREA 2
#define B_EXECUTE_AREA 4 #define B_EXECUTE_AREA 4
#define B_STACK_AREA 8 #define B_STACK_AREA 8
// "stack" protection is not available on most platforms - it's used /* "stack" protection is not available on most platforms - it's used
// to only commit memory as needed, and have guard pages at the to only commit memory as needed, and have guard pages at the
// bottom of the stack. bottom of the stack. */
extern area_id create_area(const char *name, void **startAddress, extern area_id create_area(const char *name, void **startAddress,
uint32 addressSpec, size_t size, uint32 lock, uint32 addressSpec, size_t size, uint32 lock,
@@ -381,7 +381,7 @@ extern bigtime_t system_time(void);
extern nanotime_t system_time_nsecs(void); extern nanotime_t system_time_nsecs(void);
/* time since booting in nanoseconds */ /* time since booting in nanoseconds */
// deprecated (is no-op) /* deprecated (is no-op) */
extern status_t set_timezone(const char *timezone); extern status_t set_timezone(const char *timezone);
/* Alarm */ /* Alarm */
+15 -17
View File
@@ -34,44 +34,42 @@ typedef struct {
int32 text_size; int32 text_size;
int32 data_size; int32 data_size;
// Haiku R1 extensions /* Haiku R1 extensions */
int32 api_version; // the Haiku API version used by the image int32 api_version; /* the Haiku API version used by the image */
int32 abi; // the Haiku ABI used by the image int32 abi; /* the Haiku ABI used by the image */
} image_info; } image_info;
// flags for clear_caches() /* flags for clear_caches() */
#define B_FLUSH_DCACHE 0x0001 /* data cache */ #define B_FLUSH_DCACHE 0x0001 /* data cache */
#define B_FLUSH_ICACHE 0x0004 /* instruction cache */ #define B_FLUSH_ICACHE 0x0004 /* instruction cache */
#define B_INVALIDATE_DCACHE 0x0002 #define B_INVALIDATE_DCACHE 0x0002
#define B_INVALIDATE_ICACHE 0x0008 #define B_INVALIDATE_ICACHE 0x0008
// symbol types /* symbol types */
#define B_SYMBOL_TYPE_DATA 0x1 #define B_SYMBOL_TYPE_DATA 0x1
#define B_SYMBOL_TYPE_TEXT 0x2 #define B_SYMBOL_TYPE_TEXT 0x2
#define B_SYMBOL_TYPE_ANY 0x5 #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_BEFORE_FUNCTION_NAME "initialize_before"
#define B_INIT_AFTER_FUNCTION_NAME "initialize_after" #define B_INIT_AFTER_FUNCTION_NAME "initialize_after"
#define B_TERM_BEFORE_FUNCTION_NAME "terminate_before" #define B_TERM_BEFORE_FUNCTION_NAME "terminate_before"
#define B_TERM_AFTER_FUNCTION_NAME "terminate_after" #define B_TERM_AFTER_FUNCTION_NAME "terminate_after"
#define B_APP_IMAGE_SYMBOL ((void*)(addr_t)0) #define B_APP_IMAGE_SYMBOL ((void*)(addr_t)0)
// value that can be used instead of a pointer to a symbol in the program /* value that can be used instead of a pointer to a symbol in the program
// image. image. */
#define B_CURRENT_IMAGE_SYMBOL ((void*)&__haiku_init_before) #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 { enum {
B_WAIT_TILL_LOADED = 0x01, B_WAIT_TILL_LOADED = 0x01,
// Wait till the loader has loaded and relocated /* Wait till the loader has loaded and relocated (but not yet
// (but not yet initialized) the application initialized) the application image and all dependencies. If not
// image and all dependencies. If not supplied, supplied, the function returns before the loader started to do
// the function returns before the loader anything at all, i.e. it returns success, even if the executable
// started to do anything at all, i.e. it doesn't exist. */
// returns success, even if the executable
// doesn't exist.
}; };
#ifdef __cplusplus #ifdef __cplusplus
+11 -11
View File
@@ -11,7 +11,7 @@
#include <limits.h> #include <limits.h>
// Limits /* Limits */
#define B_DEV_NAME_LENGTH 128 #define B_DEV_NAME_LENGTH 128
#define B_FILE_NAME_LENGTH NAME_MAX #define B_FILE_NAME_LENGTH NAME_MAX
#define B_PATH_NAME_LENGTH MAXPATHLEN #define B_PATH_NAME_LENGTH MAXPATHLEN
@@ -19,17 +19,17 @@
#define B_MIME_TYPE_LENGTH (B_ATTR_NAME_LENGTH - 15) #define B_MIME_TYPE_LENGTH (B_ATTR_NAME_LENGTH - 15)
#define B_MAX_SYMLINKS SYMLOOP_MAX #define B_MAX_SYMLINKS SYMLOOP_MAX
// Open Modes /* Open Modes */
#define B_READ_ONLY O_RDONLY // read only #define B_READ_ONLY O_RDONLY /* read only */
#define B_WRITE_ONLY O_WRONLY // write only #define B_WRITE_ONLY O_WRONLY /* write only */
#define B_READ_WRITE O_RDWR // read and write #define B_READ_WRITE O_RDWR /* read and write */
#define B_FAIL_IF_EXISTS O_EXCL // exclusive create #define B_FAIL_IF_EXISTS O_EXCL /* exclusive create */
#define B_CREATE_FILE O_CREAT // create the file #define B_CREATE_FILE O_CREAT /* create the file */
#define B_ERASE_FILE O_TRUNC // erase the file's data #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_OPEN_AT_END O_APPEND /* point to the end of the data */
// Node Flavors /* Node Flavors */
enum node_flavor { enum node_flavor {
B_FILE_NODE = 0x01, B_FILE_NODE = 0x01,
B_SYMLINK_NODE = 0x02, B_SYMLINK_NODE = 0x02,
@@ -38,4 +38,4 @@ enum node_flavor {
}; };
#endif // _DEF_STORAGE_H #endif /* _DEF_STORAGE_H */