Opened 5 years ago

Last modified 4 years ago

#10667 new defect

preprocessorErrorDirective with macro expansion because of define in configuration

Reported by: kidkat Owned by: noone
Priority: Normal Milestone:
Component: Other Version:
Keywords: preprocessorErrorDirective Cc:

Description (last modified by kidkat)

#define TEST_CASE( NAME )  do { if (prepareTest(#NAME)) { setVerbose(false); NAME(); } } while (false)

class A
{
    void run() {
        TEST_CASE(foreach);
    }

    void foreach () {
    }
};
/mnt/s/GitHub/cppcheck-fw/test/testtokenize.cpp:1:0: error: failed to expand 'TEST_CASE', Wrong number of parameters for macro 'foreach'. [preprocessorErrorDirective]
#define TEST_CASE( NAME )  do { if (prepareTest(#NAME)) { setVerbose(false); NAME(); } } while (false)
^

This happens when you pass --library=qt because it interprets the functionforeach as define:

  <define name="foreach(A,B)" value="for(A:B)"/>

Change History (2)

comment:1 by kidkat, 5 years ago

This breaks running Cppcheck on itself with all required defines and libraries specified.

comment:2 by kidkat, 4 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.