From 17c7c1729eaf770dd272205e249c200b22e9603c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 4 Jul 2020 11:49:09 +0100 Subject: orcc: use #pragma once in generated headers Simplifies code and removes build path fragments from generated file (paths may be different if generated in a gst-build setup). There shouldn't be any portability issues with this. Meson has been using this in its generated config.h for years. Part-of: --- tools/orcc.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'tools') diff --git a/tools/orcc.c b/tools/orcc.c index 7d58593..3585e93 100644 --- a/tools/orcc.c +++ b/tools/orcc.c @@ -22,7 +22,6 @@ void output_code_assembly (OrcProgram *p, FILE *output); void output_code_execute (OrcProgram *p, FILE *output, int is_inline); void output_program_generation (OrcProgram *p, FILE *output, int is_inline); void output_init_function (FILE *output); -static char * get_barrier (const char *s); static const char * my_basename (const char *s); int verbose = 0; @@ -319,11 +318,7 @@ main (int argc, char *argv[]) fprintf(output, "\n"); } } else if (mode == MODE_HEADER) { - char *barrier = get_barrier (output_file); - - fprintf(output, "#ifndef _%s_\n", barrier); - fprintf(output, "#define _%s_\n", barrier); - free (barrier); + fprintf(output, "#pragma once\n"); fprintf(output, "\n"); if (include_file) { fprintf(output, "#include <%s>\n", include_file); @@ -357,8 +352,6 @@ main (int argc, char *argv[]) fprintf(output, "}\n"); fprintf(output, "#endif\n"); fprintf(output, "\n"); - fprintf(output, "#endif\n"); - fprintf(output, "\n"); } else if (mode == MODE_TEST) { fprintf(output, "#include \n"); fprintf(output, "#include \n"); @@ -450,28 +443,6 @@ main (int argc, char *argv[]) return 0; } - -static char * -get_barrier (const char *s) -{ - char *barrier; - int n; - int i; - - n = strlen(s); - barrier = malloc (n + 1); - for(i=0;i