Generate macros to help unity builds in the presence of anonymous namespaces
Given foo.cpp
containing
namespace {
int localVal = 42;
}
int doFooThings(int input)
{
return input * localVal;
}
and bar.cpp
containing
namespace {
int localVal = 42;
}
int doBarThings(int input)
{
return input + localVal;
}
we can compile foo.cpp
and bar.cpp
separately. However, when we try to compile both in a unity build translation unit, the two definitions of localVar
cause an error to be reported.
Feature request: Design some way to allow users to conveniently handle that situation.