summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-02-24 04:56:54 +0100
committerRichard Braun <rbraun@sceen.net>2018-02-24 04:56:54 +0100
commit97f83b42af28a9ecbfd714a8337fd399a32cfb78 (patch)
treec57ba504ece0a3b127de745774c0bd72d85436dc
parent092153af96c9d504d8b76973f6796bcd106801ec (diff)
Don't use reserved identifiers
See C99 7.1.3 Reserved identifiers.
-rw-r--r--include/assert.h6
-rw-r--r--include/errno.h6
-rw-r--r--include/limits.h6
-rw-r--r--include/stdio.h6
-rw-r--r--include/stdlib.h6
-rw-r--r--include/string.h6
-rw-r--r--lib/cbuf.h6
-rw-r--r--lib/fmt.h6
-rw-r--r--lib/hash.h6
-rw-r--r--lib/list.h18
-rw-r--r--lib/macros.h6
-rw-r--r--lib/shell.h18
-rw-r--r--src/boot.h6
-rw-r--r--src/condvar.h6
-rw-r--r--src/cpu.h6
-rw-r--r--src/io.h6
-rw-r--r--src/mem.h6
-rw-r--r--src/mutex.h6
-rw-r--r--src/panic.h6
-rw-r--r--src/sw.h6
-rw-r--r--src/thread.h6
-rw-r--r--src/timer.h6
-rw-r--r--src/uart.h6
23 files changed, 81 insertions, 81 deletions
diff --git a/include/assert.h b/include/assert.h
index 2d02457..e045379 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -20,8 +20,8 @@
* DEALINGS IN THE SOFTWARE.
*/
-#ifndef _ASSERT_H
-#define _ASSERT_H
+#ifndef ASSERT_H
+#define ASSERT_H
#ifdef NDEBUG
@@ -50,4 +50,4 @@ MACRO_END
#endif /* NDEBUG */
-#endif /* _ASSERT_H */
+#endif /* ASSERT_H */
diff --git a/include/errno.h b/include/errno.h
index f1987f6..ab4a406 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -20,8 +20,8 @@
* DEALINGS IN THE SOFTWARE.
*/
-#ifndef _ERRNO_H
-#define _ERRNO_H
+#ifndef ERRNO_H
+#define ERRNO_H
#define EINVAL 1
#define EAGAIN 2
@@ -30,4 +30,4 @@
#define EBUSY 5
#define EEXIST 6
-#endif /* _ERRNO_H */
+#endif /* ERRNO_H */
diff --git a/include/limits.h b/include/limits.h
index e2b5fd6..bd188ad 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -20,9 +20,9 @@
* DEALINGS IN THE SOFTWARE.
*/
-#ifndef _LIMITS_H
-#define _LIMITS_H
+#ifndef LIMITS_H
+#define LIMITS_H
#define CHAR_BIT 8
-#endif /* _LIMITS_H */
+#endif /* LIMITS_H */
diff --git a/include/stdio.h b/include/stdio.h
index d334ac4..14eee2f 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -23,8 +23,8 @@
* Subset of the standard C stdio interface.
*/
-#ifndef _STDIO_H
-#define _STDIO_H
+#ifndef STDIO_H
+#define STDIO_H
#include <stdarg.h>
@@ -53,4 +53,4 @@ int vprintf(const char *format, va_list ap)
#define sscanf fmt_sscanf
#define vsscanf fmt_vsscanf
-#endif /* _STDIO_H */
+#endif /* STDIO_H */
diff --git a/include/stdlib.h b/include/stdlib.h
index 053396e..a40dded 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -20,12 +20,12 @@
* DEALINGS IN THE SOFTWARE.
*/
-#ifndef _STDLIB_H
-#define _STDLIB_H
+#ifndef STDLIB_H
+#define STDLIB_H
#include <src/mem.h>
#define malloc mem_alloc
#define free mem_free
-#endif /* _STDLIB_H */
+#endif /* STDLIB_H */
diff --git a/include/string.h b/include/string.h
index 36e71da..fb11a78 100644
--- a/include/string.h
+++ b/include/string.h
@@ -20,8 +20,8 @@
* DEALINGS IN THE SOFTWARE.
*/
-#ifndef _STRING_H
-#define _STRING_H
+#ifndef STRING_H
+#define STRING_H
#include <stddef.h>
@@ -35,4 +35,4 @@ int strcmp(const char *s1, const char *s2);
int strncmp(const char *s1, const char *s2, size_t n);
char * strerror(int errnum);
-#endif /* _STRING_H */
+#endif /* STRING_H */
diff --git a/lib/cbuf.h b/lib/cbuf.h
index 8b46cd4..83975db 100644
--- a/lib/cbuf.h
+++ b/lib/cbuf.h
@@ -26,8 +26,8 @@
* Circular byte buffer.
*/
-#ifndef _CBUF_H
-#define _CBUF_H
+#ifndef CBUF_H
+#define CBUF_H
#include <stdbool.h>
#include <stddef.h>
@@ -147,4 +147,4 @@ int cbuf_write(struct cbuf *cbuf, size_t index, const void *buf, size_t size);
*/
int cbuf_read(const struct cbuf *cbuf, size_t index, void *buf, size_t *sizep);
-#endif /* _CBUF_H */
+#endif /* CBUF_H */
diff --git a/lib/fmt.h b/lib/fmt.h
index babaa52..24ca7b0 100644
--- a/lib/fmt.h
+++ b/lib/fmt.h
@@ -42,8 +42,8 @@
* - specifiers: d i o u x X c s p n %
*/
-#ifndef _FMT_H
-#define _FMT_H
+#ifndef FMT_H
+#define FMT_H
#include <stdarg.h>
#include <stddef.h>
@@ -66,4 +66,4 @@ int fmt_sscanf(const char *str, const char *format, ...)
int fmt_vsscanf(const char *str, const char *format, va_list ap)
__attribute__((format(scanf, 2, 0)));
-#endif /* _FMT_H */
+#endif /* FMT_H */
diff --git a/lib/hash.h b/lib/hash.h
index 92f3180..d14f331 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -44,8 +44,8 @@
* HASH_ALLBITS macro.
*/
-#ifndef _HASH_H
-#define _HASH_H
+#ifndef HASH_H
+#define HASH_H
#include <assert.h>
#include <stdint.h>
@@ -120,4 +120,4 @@ hash_str(const char *str, unsigned int bits)
return hash & ((1 << bits) - 1);
}
-#endif /* _HASH_H */
+#endif /* HASH_H */
diff --git a/lib/list.h b/lib/list.h
index 80afd71..0df77dd 100644
--- a/lib/list.h
+++ b/lib/list.h
@@ -26,8 +26,8 @@
* Doubly-linked list.
*/
-#ifndef _LIST_H
-#define _LIST_H
+#ifndef LIST_H
+#define LIST_H
#include <stdbool.h>
#include <stddef.h>
@@ -493,14 +493,14 @@ list_llsync_remove(struct list *node)
*/
#define list_llsync_first_entry(list, type, member) \
MACRO_BEGIN \
- struct list *___list; \
- struct list *___first; \
+ struct list *list___; \
+ struct list *first___; \
\
- ___list = (list); \
- ___first = list_llsync_first(___list); \
- list_end(___list, ___first) \
+ list___ = (list); \
+ first___ = list_llsync_first(list___); \
+ list_end(list___, first___) \
? NULL \
- : list_entry(___first, type, member); \
+ : list_entry(first___, type, member); \
MACRO_END
/*
@@ -535,4 +535,4 @@ for (entry = list_llsync_entry(list_first(list), \
entry = list_llsync_entry(list_next(&entry->member), \
typeof(*entry), member))
-#endif /* _LIST_H */
+#endif /* LIST_H */
diff --git a/lib/macros.h b/lib/macros.h
index 6369599..eb19657 100644
--- a/lib/macros.h
+++ b/lib/macros.h
@@ -26,8 +26,8 @@
* Helper macros.
*/
-#ifndef _MACROS_H
-#define _MACROS_H
+#ifndef MACROS_H
+#define MACROS_H
#if !defined(__GNUC__) || (__GNUC__ < 4)
#error "GCC 4+ required"
@@ -103,4 +103,4 @@
#endif /* __GNUC__ >= 7 */
#endif
-#endif /* _MACROS_H */
+#endif /* MACROS_H */
diff --git a/lib/shell.h b/lib/shell.h
index b5ce7d5..0ba0edc 100644
--- a/lib/shell.h
+++ b/lib/shell.h
@@ -26,8 +26,8 @@
* Minimalist shell for embedded systems.
*/
-#ifndef _SHELL_H
-#define _SHELL_H
+#ifndef SHELL_H
+#define SHELL_H
#include <errno.h>
#include <stddef.h>
@@ -39,14 +39,14 @@
#define SHELL_REGISTER_CMDS(cmds) \
MACRO_BEGIN \
- size_t ___i; \
- int ___error; \
+ size_t i___; \
+ int error___; \
\
- for (___i = 0; ___i < ARRAY_SIZE(cmds); ___i++) { \
- ___error = shell_cmd_register(&(cmds)[___i]); \
+ for (i___ = 0; i___ < ARRAY_SIZE(cmds); i___++) { \
+ error___ = shell_cmd_register(&(cmds)[i___]); \
\
- if (___error) { \
- panic("%s: %s", __func__, strerror(___error)); \
+ if (error___) { \
+ panic("%s: %s", __func__, strerror(error___)); \
} \
} \
MACRO_END
@@ -96,4 +96,4 @@ void shell_setup(void);
*/
int shell_cmd_register(struct shell_cmd *cmd);
-#endif /* _SHELL_H */
+#endif /* SHELL_H */
diff --git a/src/boot.h b/src/boot.h
index d813605..781e8fe 100644
--- a/src/boot.h
+++ b/src/boot.h
@@ -21,8 +21,8 @@
* DEALINGS IN THE SOFTWARE.
*/
-#ifndef _BOOT_H
-#define _BOOT_H
+#ifndef BOOT_H
+#define BOOT_H
/*
* The size of the boot stack.
@@ -31,4 +31,4 @@
*/
#define BOOT_STACK_SIZE 4096
-#endif /* _BOOT_H */
+#endif /* BOOT_H */
diff --git a/src/condvar.h b/src/condvar.h
index 1448d69..ad93505 100644
--- a/src/condvar.h
+++ b/src/condvar.h
@@ -40,8 +40,8 @@
* [1] http://pubs.opengroup.org/onlinepubs/9699919799/
*/
-#ifndef _CONDVAR_H
-#define _CONDVAR_H
+#ifndef CONDVAR_H
+#define CONDVAR_H
#include <lib/list.h>
@@ -146,4 +146,4 @@ void condvar_broadcast(struct condvar *condvar);
*/
void condvar_wait(struct condvar *condvar, struct mutex *mutex);
-#endif /* _CONDVAR_H */
+#endif /* CONDVAR_H */
diff --git a/src/cpu.h b/src/cpu.h
index bedf0f0..bc3cd46 100644
--- a/src/cpu.h
+++ b/src/cpu.h
@@ -28,8 +28,8 @@
* See the i8259 module.
*/
-#ifndef _CPU_H
-#define _CPU_H
+#ifndef CPU_H
+#define CPU_H
/*
* EFLAGS register flags.
@@ -133,4 +133,4 @@ void cpu_setup(void);
#endif /* __ASSEMBLER__ */
-#endif /* _CPU_H */
+#endif /* CPU_H */
diff --git a/src/io.h b/src/io.h
index 19aa719..022bb6d 100644
--- a/src/io.h
+++ b/src/io.h
@@ -29,8 +29,8 @@
* used for this purpose, at least for some legacy devices.
*/
-#ifndef _IO_H
-#define _IO_H
+#ifndef IO_H
+#define IO_H
#include <stdint.h>
@@ -44,4 +44,4 @@ uint8_t io_read(uint16_t port);
*/
void io_write(uint16_t port, uint8_t byte);
-#endif /* _IO_H */
+#endif /* IO_H */
diff --git a/src/mem.h b/src/mem.h
index b04837a..38f1af7 100644
--- a/src/mem.h
+++ b/src/mem.h
@@ -27,8 +27,8 @@
* memory allocated at compile time by the linker.
*/
-#ifndef _MEM_H
-#define _MEM_H
+#ifndef MEM_H
+#define MEM_H
#include <stddef.h>
@@ -89,4 +89,4 @@ void * mem_alloc(size_t size);
*/
void mem_free(void *ptr);
-#endif /* _MEM_H */
+#endif /* MEM_H */
diff --git a/src/mutex.h b/src/mutex.h
index fedbb8f..a52bb41 100644
--- a/src/mutex.h
+++ b/src/mutex.h
@@ -113,8 +113,8 @@
* particular, a mutex cannot be locked recursively.
*/
-#ifndef _MUTEX_H
-#define _MUTEX_H
+#ifndef MUTEX_H
+#define MUTEX_H
#include <stdbool.h>
@@ -162,4 +162,4 @@ int mutex_trylock(struct mutex *mutex);
*/
void mutex_unlock(struct mutex *mutex);
-#endif /* _MUTEX_H */
+#endif /* MUTEX_H */
diff --git a/src/panic.h b/src/panic.h
index be91405..2b557f7 100644
--- a/src/panic.h
+++ b/src/panic.h
@@ -20,8 +20,8 @@
* DEALINGS IN THE SOFTWARE.
*/
-#ifndef _PANIC_H
-#define _PANIC_H
+#ifndef PANIC_H
+#define PANIC_H
#include <lib/macros.h>
@@ -29,4 +29,4 @@ void panic(const char *format, ...)
__attribute__((noreturn))
__attribute__((format(printf, 1, 2)));
-#endif /* _PANIC_H */
+#endif /* PANIC_H */
diff --git a/src/sw.h b/src/sw.h
index 91488c3..d43ea1c 100644
--- a/src/sw.h
+++ b/src/sw.h
@@ -23,12 +23,12 @@
* Stopwatch demo application.
*/
-#ifndef _SW_H
-#define _SW_H
+#ifndef SW_H
+#define SW_H
/*
* Initialize the sw module.
*/
void sw_setup(void);
-#endif /* _SW_H */
+#endif /* SW_H */
diff --git a/src/thread.h b/src/thread.h
index 78f87da..61c802e 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -80,8 +80,8 @@
* preemption enabled during the critical section.
*/
-#ifndef _THREAD_H
-#define _THREAD_H
+#ifndef THREAD_H
+#define THREAD_H
#include <stdbool.h>
#include <stddef.h>
@@ -323,4 +323,4 @@ void thread_report_tick(void);
*/
void thread_enable_scheduler(void) __attribute__((noreturn));
-#endif /* _THREAD_H */
+#endif /* THREAD_H */
diff --git a/src/timer.h b/src/timer.h
index e4a531e..218d28b 100644
--- a/src/timer.h
+++ b/src/timer.h
@@ -23,8 +23,8 @@
* Software timer module.
*/
-#ifndef _TIMER_H
-#define _TIMER_H
+#ifndef TIMER_H
+#define TIMER_H
#include <stdbool.h>
@@ -133,4 +133,4 @@ unsigned long timer_get_time(const struct timer *timer);
*/
void timer_report_tick(void);
-#endif /* _TIMER_H */
+#endif /* TIMER_H */
diff --git a/src/uart.h b/src/uart.h
index c3b91db..81f7375 100644
--- a/src/uart.h
+++ b/src/uart.h
@@ -30,8 +30,8 @@
* communication.
*/
-#ifndef _UART_H
-#define _UART_H
+#ifndef UART_H
+#define UART_H
#include <stdint.h>
@@ -58,4 +58,4 @@ void uart_write(uint8_t byte);
*/
int uart_read(uint8_t *byte);
-#endif /* _UART_H */
+#endif /* UART_H */