Fix params.c build warnings
[petitboot] / discover / parser-utils.h
index e82e3f9c81638be7cdbe2bedcbcca2eba98f66fa..781867c4c22fe496f7d54f94991aff7b61e7597b 100644 (file)
@@ -1,12 +1,23 @@
 #ifndef PARSER_UTILS_H
 #define PARSER_UTILS_H
 
+#include "pb-protocol/pb-protocol.h"
 #include "parser.h"
 
 #define streq(a,b) (!strcasecmp((a),(b)))
 
 #define artwork_pathname(file) (PKG_SHARE_DIR "/artwork/" file)
 
+#define define_parser(__name, __priority, __parse_fn)                  \
+       struct parser                                                   \
+               __attribute__((unused, section("parsers")))             \
+       __ ## __name ## _parser = {                                     \
+               .name           = #__name,                              \
+               .priority       = __priority,                           \
+               .parse          = __parse_fn,                           \
+       };
+
+
 void device_add_boot_option(struct device *device,
                struct boot_option *boot_option);