aboutsummaryrefslogtreecommitdiff
path: root/include/apos/attrs.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-05-29 16:23:41 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-05-29 16:23:41 +0300
commitd7cb08134102b7a2410c48d2a1802193f9031e00 (patch)
tree711498836d6679ca2fc3b4ba9369b7fe53d7a3fa /include/apos/attrs.h
parente148f38dc937c34b222ba8df8612b3fa2b6bc349 (diff)
downloadkmi-d7cb08134102b7a2410c48d2a1802193f9031e00.tar.gz
kmi-d7cb08134102b7a2410c48d2a1802193f9031e00.zip
continue documentation efforts
Diffstat (limited to 'include/apos/attrs.h')
-rw-r--r--include/apos/attrs.h54
1 files changed, 45 insertions, 9 deletions
diff --git a/include/apos/attrs.h b/include/apos/attrs.h
index 3825ece..9729000 100644
--- a/include/apos/attrs.h
+++ b/include/apos/attrs.h
@@ -6,20 +6,56 @@
* Attribute shorthands.
*/
-/* TODO: figure out which attributes are necessary and which are good to have */
+/**
+ * Ask the preprocessor if specified attribute is available.
+ * Currently unused, but I really should use it.
+ *
+ * @param x Attribute whose existence should be checked.
+ * @return Non-zero when available, \c 0 when not available.
+ * @todo Figure out which attributes are necessary and which are good to have
+ */
#if !defined(__has_attribute)
#define __has_attribute(x) 0
#endif
+/**
+ * Place object into section.
+ *
+ * @param section Section name to place the object in.
+ */
#define __section(section) __attribute__((__section__(section)))
-#define __fmt(x, y) __attribute__((format(__printf__, x, y)))
-#define __aligned(a) __attribute__((aligned(a)))
-#define __noinline __attribute__((noinline))
-#define __noreturn __attribute__((noreturn))
-#define __packed __attribute__((packed))
-#define __weak __attribute__((weak))
-#define __main __section(".kernel.start") __noinline
-#define __init __section(".init.start") __noinline
+/**
+ * Inform the compiler that the function uses printf formatting.
+ *
+ * @param x Index of the format string.
+ * @param y Index of variadic arguments.
+ */
+#define __fmt(x, y) __attribute__((format(__printf__, x, y)))
+
+/**
+ * Align object.
+ *
+ * @param a Value to which object should be aligned.
+ */
+#define __aligned(a) __attribute__((aligned(a)))
+
+/** Don't inline function. */
+#define __noinline __attribute__((noinline))
+
+/** Function should not return. */
+#define __noreturn __attribute__((noreturn))
+
+/** Pack structure. */
+#define __packed __attribute__((packed))
+
+/** Weak linkage. */
+#define __weak __attribute__((weak))
+
+/** Main entry point of kernel proper. */
+#define __main __section(".kernel.start") __noinline
+
+/** Entry point of kernel loader. */
+#define __init __section(".init.start") __noinline
#endif /* APOS_COMPILER_ATTRIBUTES_H */