Menu

Preprocessor: multiline #pragma results in syntaxError

CHR
2021-04-26
2021-04-28
  • CHR

    CHR - 2021-04-26
    #pragma comment(linker, "foo \
    bar")
    

    Cppcheck 2.4.1 reports

    Checking foo.cpp ...
    foo.cpp:2:5: error: Unmatched ')'. Configuration: ''. [syntaxError]
    bar")
        ^
    

    If the line break/continuation is removed, the error disappears. I'm not sure if this is related to cppcheck itself or the preprocessor component.

     
  • CHR

    CHR - 2021-04-27

    Running simplecpp on the code above gives the following output

    )
    

    Obviously the closing parenthesis should be grouped together with the rest of the previous line.
    I think things go wrong near line 671 in simplecpp.cpp (TokenList::readfile), but I don't know how to fix it properly.

     
    • Daniel Marjamäki

      thanks! I can reproduce.. do you have a github account? I would appreciate a ticket in the simplecpp issue tracket; https://github.com/danmar/simplecpp/issues

       
  • CHR

    CHR - 2021-04-28
     

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.