shevek / jcpp

The C Preprocessor as a Java library
http://www.anarres.org/projects/jcpp/
Apache License 2.0
107 stars 36 forks source link

Support for MS #pragma once #5

Closed ochafik closed 10 years ago

ochafik commented 11 years ago

Lots of headers on Windows use #pragma once instead of ifndef guards (or at least, used to use it when I last checked), so this feature is quite important.

See MSDN documentation

JNAerator uses a hack that involves overriding Preprocessor.include (using a forked jcpp where this is possible), but it would be great if jcpp had native support for this (err... maybe it does already, thanks for letting me know in that case :-))

shevek commented 10 years ago

include() exposed in github; will look at supporting pragma once.

shevek commented 10 years ago

Is there an implication from your code that a #pragma once can appear in something which is not a FileLexerSource? Surely it can only appear at top level?

shevek commented 10 years ago

Oh, I see it. I shot myself with VirtualFile didn't I. :-(

shevek commented 10 years ago

Implemented in github, will make 1.4.1. Enable Feature.PRAGMA_ONCE. Please let me know if this satisfies?