adamdruppe / arsd

This is a collection of modules that I've released over the years. Most of them stand alone, or have just one or two dependencies in here, so you don't have to download this whole repo.
http://arsd-official.dpldocs.info/arsd.html
530 stars 128 forks source link

Fix nanovega compilation warnings #173

Closed WebFreak001 closed 5 years ago

WebFreak001 commented 5 years ago

include and #define made dmd and ldc very unhappy.

Fixes

/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13215,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13216,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13217,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13218,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13219,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13220,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13221,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13222,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13223,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13224,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13225,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13226,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13227,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13228,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13229,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13230,12): Warning: C preprocessor directive #define is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13245,11): Warning: C preprocessor directive #ifdef is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13250,11): Warning: C preprocessor directive #endif is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13261,13): Warning: C preprocessor directive #ifdef is not supported
/home/webfreak/.dub/packages/arsd-official-2.1.2/arsd-official/nanovega.d(13266,13): Warning: C preprocessor directive #endif is not supported
adamdruppe commented 5 years ago

Stupid dmd shouldn't be warning on a string literal! Even if it is a token string, it shouldn't be getting semantic warnings.

But still, i guess better to shut it up somehow.

0xEAB commented 5 years ago

Has the DMD bug been reported on the dlang Bugzilla yet?

adamdruppe commented 5 years ago

On Sun, Nov 11, 2018 at 09:57:20AM -0800, Elias Batek wrote:

Has the DMD bug already been reported on the dlang Bugzilla?

I don't think so.

It should be trivial to reproduce though:

auto a = q{

define whatever;

};

and compile with -wi and it is shown. I suspect the lexer is what generates the warning. The q{} strings pass through the D lexer (this is why they must be valid D tokens) and my guess is it looks at the global warnings flag variable without understanding that it is in a context where it is irrelevant.