[Solved]Is there a way for GCC to ignore invalid directives?
Posted: Mon Nov 02, 2020 4:15 am
Hi, I want GCC NOT to error out on invalid directive.
I need some C code to be runnable from command line as scripts. I am using TCC's (Tiny C Compiler) -run option, which allows to do just that. To simplify some Shell scripts (some of these C scripts need special invocation) I am using interpreter line inside the script. Something like:
The problem is that it's difficult to debug code started this way. From time to time I need to properly compile and run such script with GCC and debug with GDB. But whenever GCC encounters first line, it errors out, complaining about invalid directive. For now I just comment out first line whenever I am using GCC, but sometimes I forget to uncomment it before commiting the code to repository and this causes some breakage in my Shell scripts. Is there some way to tell GCC to ignore first line or invalid directives?
I need some C code to be runnable from command line as scripts. I am using TCC's (Tiny C Compiler) -run option, which allows to do just that. To simplify some Shell scripts (some of these C scripts need special invocation) I am using interpreter line inside the script. Something like:
Code: Select all
#!/usr/bin/tcc -run
#include <stdio.h>
int main()
{
printf("Trolololo!\n");
return 0;
}