POETSII / Orchestrator

The Orchestrator is the configuration and run-time management system for POETS platforms.
1 stars 1 forks source link

Typenamed-macros cause format warnings when compiled with clang. #292

Closed mvousden closed 2 years ago

mvousden commented 2 years ago

Given source in main.cpp:

#include <macros.h>
#include <map>
int main()
{
    int rc;
    std::map<int, int> disaster;
    disaster[0] = 0;
    WALKMAP(int, int, disaster, tmp) rc = tmp->second;
    return rc;
}

clang 12.0.1 compiles with warnings (using clang++ -Wall -pedantic -O0 -std=c++98 -I{$GENERICS_DIR} main.cpp)

main.cpp:8:5: warning: 'typename' occurs outside of a template [-Wc++11-extensions]
    WALKMAP(int, int, disaster, tmp) rc = tmp->second;
    ^
/home/mark/repos/orchestrator/Generics/macros.h:36:13: note: expanded from macro 'WALKMAP'
        for(TN std::map<KT,DT>::iterator i=v.begin();i!=v.end();i++)
            ^
/home/mark/repos/orchestrator/Generics/macros.h:12:12: note: expanded from macro 'TN'
#define TN typename
           ^
1 warning generated.