1

I'm looking for a reentrant preprocessor compliant with most C/C++ standards.

In fact, I'd like something like mcpp but reentrant to enable multiple files to be parsed at same time. I need also a minimal cross-platform compatibility (Linux or POSIX and Windows).

When searching for "C preprocessor" on Google, I get only courses on the C preprocessor syntax.

Do you know some of them?

7
  • 1
    Have you ruled out running each preprocessor in its own process? How many files do you need to preprocess in parallel? Commented Sep 23, 2014 at 13:36
  • 1
    Yes I'm thinking about using multi-process, but I didn't find a portable way while pthread is implemented on many platforms... I need to parse 50 to 100 files (it's to make a C parser for embeded code analysis)
    – hl037_
    Commented Sep 23, 2014 at 14:27
  • 1
    You are correct about non-portable processes. That would imply to me that you would use a shim to fork the processes. Create .sh and .bat files, fork using sh or cmd.exe as the executable and the arguments are your batch file and your source files. Let the batch file determine the parallelism and process reuse. Commented Sep 23, 2014 at 15:24
  • 1
    As a general rule, I wouldn't expect you to find preprocessors independent of compilers (or similar tools); what would the motivation of the author be? I'd guess one answer is simply lift a preprocessor from an existing compiler, and make it re-entrant.
    – Ira Baxter
    Commented Sep 28, 2014 at 3:39
  • 1
    Remarkably, I do know of one that can run parallel threads, in the same process, one per file to be preprocessed. It is not LGPL, OS independent or portable, but then your question isn't clear about what other properties you want from this preprocessor. I suggest you visit the help menu, and review/revise your question accordingly.
    – Ira Baxter
    Commented Sep 28, 2014 at 3:41

1 Answer 1

1

this is a very late answer. but I wrote simplecpp (http://github.com/danmar/simplecpp). it is lgpl, reentrant and portable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.