Menu

Syntax error in '#if 1'

SlipCore
2023-05-19
2023-05-19
  • SlipCore

    SlipCore - 2023-05-19

    Test example:

    struct stage_info stages[] =
    {
        [0] = {
            .type = &stage_test_type,
            .conf = &(struct stage_test_conf) {
    #if 1
                .mode = 0,
    
    #endif
            }.base,
        },
    }
    

    Getting error: Syntax error in #if [preprocessorErrorDirective] in simple #if 1 directive:

    Checking test.c ...
    test.c:6:0: error: Syntax error in #if [preprocessorErrorDirective]
    #if 1
    

    It can be fixed with parentheses: #if (1)

    There are many places in the our sources with such conditional preprocessor directives without parentheses, but the syntax error does not occur in all cases.

     
  • CHR

    CHR - 2023-05-19

    Thanks for reporting, I have created an issue here: https://github.com/danmar/simplecpp/issues/297

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.