atilaneves / dpp

Directly include C headers in D source code
Boost Software License 1.0
230 stars 31 forks source link

Fail preprocessing the README example in macOS #160

Closed pinver closed 5 years ago

pinver commented 5 years ago

I know that actually macOS is not supported, but actually, the README example foo.dpp is emitted for preprocessing as foo.d.tmp:

<snip>
        struct __locale_data { int dummy; }  // FIXME                                                                   
        #define __gnuc_va_list va_list                                                                                  
    #define __is_empty(_Type) dpp.isEmpty!(_Type)                                                                       
 alias _Bool = bool;                                                                                                     
<snip>

which is preprocessed in foo.d as

         struct __locale_data { int dummy; }  // FIXME                                                                   

     #define __is_empty(_Type) dpp.isEmpty!(_Type)                                                                       
 alias _Bool = bool;                                                                                                     

If another '\n' is added to the preamble at line 256 of source/dpp/runtime/app.d:

256           "    #define __gnuc_va_list va_list\n\n" ~                                                                      
257           "    #define __is_empty(_Type) dpp.isEmpty!(_Type)\n" ~                                                       

The define is correctly preprocessed... really I don't know why.

atilaneves commented 5 years ago

I don't have a mac so I can't reproduce this or work on it.

pinver commented 5 years ago

Tested again, and I can confirm that just adding the second '\n' fixes the problem...

atilaneves commented 5 years ago

Please submit a PR.