Not open source but happy to share benchmarks if that would be useful.
Large single compilation-unit C programs (2006)
11–20 of 23 posts
Re: Large single compilation-unit C programs (2006)
#12Earlier quoted context omitted.
The preprocessor doesn't remove comments and at least in clang, comments are parsed into the AST.
Well, according to C99, it should. Section "5.1.1.2 Translation phases" says (in phase 3): "Each comment is replaced by one space character." Edit: just checked and clang behaves just like gcc with -E. Maybe you didn't mean comments but preprocessor directives?
Re: Large single compilation-unit C programs (2006)
#13I've been working on a project that auto generates c programs - sometimes up to 1.5m lines of code - in a single file (actually two files but the second is only 35 lines) Not open source but happy to share benchmarks if that would be useful.
Re: Large single compilation-unit C programs (2006)
#14I've been working on a project that auto generates c programs - sometimes up to 1.5m lines of code - in a single file (actually two files but the second is only 35 lines) Not open source but happy to share benchmarks if that would be useful.
Please share the benchmarks...
Re: Large single compilation-unit C programs (2006)
#15I've been working on a project that auto generates c programs - sometimes up to 1.5m lines of code - in a single file (actually two files but the second is only 35 lines) Not open source but happy to share benchmarks if that would be useful.
Also, would you mind comparing it to Csmith (https://embed.cs.utah.edu/csmith/)?
Re: Large single compilation-unit C programs (2006)
#16Earlier quoted context omitted.
Well, according to C99, it should. Section "5.1.1.2 Translation phases" says (in phase 3): "Each comment is replaced by one space character." Edit: just checked and clang behaves just like gcc with -E. Maybe you didn't mean comments but preprocessor directives?
Clang, like GCC, has -C and -CC flags to preserve comments during preprocessing. However, these are really flags for the underlying preprocessor. Your parent might be thinking of some application of the Clang frontend that does not run preprocessing. For example, clang-format will probably not want to preprocess the code nor strip out comments.
Re: Large single compilation-unit C programs (2006)
#17May be relevant to the discussion: SQLite is also compiled from a single, 220k LOC C file called "the amalgamation". https://www.sqlite.org/amalgamation.html
I also found this "amalgamate" script on GitHub, intended to allow creating such amalgamations from C/C++ projects: https://github.com/rindeal/Amalgamate Which seems interesting, however when I tried the FreeType example, there seemed to be some preprocessing issue, such that some function definitions are conditionally excluded even though they are called later. I didn't have the time to find out if this was an issue…
Re: Large single compilation-unit C programs (2006)
#18Earlier quoted context omitted.
I also found this "amalgamate" script on GitHub, intended to allow creating such amalgamations from C/C++ projects: https://github.com/rindeal/Amalgamate Which seems interesting, however when I tried the FreeType example, there seemed to be some preprocessing issue, such that some function definitions are conditionally excluded even though they are called later. I didn't have the time to find out if this was an issue…
I'm not a C programmer, but I have heard of amalgamation, and I wonder why a standard workflow to create a single compilation unit from multiple source files isn't more straightforward.
Textual preprocessors are evil.
Re: Large single compilation-unit C programs (2006)
#19May be relevant to the discussion: SQLite is also compiled from a single, 220k LOC C file called "the amalgamation". https://www.sqlite.org/amalgamation.html
I also found this "amalgamate" script on GitHub, intended to allow creating such amalgamations from C/C++ projects: https://github.com/rindeal/Amalgamate Which seems interesting, however when I tried the FreeType example, there seemed to be some preprocessing issue, such that some function definitions are conditionally excluded even though they are called later. I didn't have the time to find out if this was an issue…
Re: Large single compilation-unit C programs (2006)
#20Earlier quoted context omitted.
The preprocessor doesn't remove comments and at least in clang, comments are parsed into the AST.
Well, according to C99, it should. Section "5.1.1.2 Translation phases" says (in phase 3): "Each comment is replaced by one space character." Edit: just checked and clang behaves just like gcc with -E. Maybe you didn't mean comments but preprocessor directives?