Commit 080b5ccd authored by Rusty Russell's avatar Rusty Russell

ccanlint: prepend module headers before standard ones.

Especially since they probably define _GNU_SOURCE.
parent 19b3fce2
...@@ -314,23 +314,24 @@ static char *mangle(struct manifest *m, char **lines) ...@@ -314,23 +314,24 @@ static char *mangle(struct manifest *m, char **lines)
bool in_function = false, fake_function = false, has_main = false; bool in_function = false, fake_function = false, has_main = false;
unsigned int i; unsigned int i;
ret = talloc_strdup(m, "/* Prepend a heap of headers. */\n" ret = talloc_asprintf(m,
"#include <assert.h>\n" "/* Include header from module. */\n"
"#include <err.h>\n" "#include <ccan/%s/%s.h>\n"
"#include <errno.h>\n" "/* Prepend a heap of headers. */\n"
"#include <fcntl.h>\n" "#include <assert.h>\n"
"#include <limits.h>\n" "#include <err.h>\n"
"#include <stdbool.h>\n" "#include <errno.h>\n"
"#include <stdint.h>\n" "#include <fcntl.h>\n"
"#include <stdio.h>\n" "#include <limits.h>\n"
"#include <stdlib.h>\n" "#include <stdbool.h>\n"
"#include <string.h>\n" "#include <stdint.h>\n"
"#include <sys/stat.h>\n" "#include <stdio.h>\n"
"#include <sys/types.h>\n" "#include <stdlib.h>\n"
"#include <unistd.h>\n"); "#include <string.h>\n"
ret = talloc_asprintf_append(ret, "/* Include header from module. */\n" "#include <sys/stat.h>\n"
"#include <ccan/%s/%s.h>\n", "#include <sys/types.h>\n"
m->basename, m->basename); "#include <unistd.h>\n",
m->basename, m->basename);
ret = talloc_asprintf_append(ret, "/* Useful dummy functions. */\n" ret = talloc_asprintf_append(ret, "/* Useful dummy functions. */\n"
"extern int somefunc(void);\n" "extern int somefunc(void);\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment