Closed v1993 closed 6 years ago
Fixed in b4c31ccf42145f7032002d27e8e899b5100516c4.
@yrnkrn Just interesting for me: it it possible to fix it, not just blacklist?
Yes! it would be much better to fix the code since marking as Mutable disables the caching.
The problem is with the code
#ifndef PARAM_PREFIX
#define PARAM_PREFIX extern
#endif
#ifndef PARAM_DEFAULT
#define PARAM_DEFAULT(X)
#endif
Whatever PARAM_PREFIX is defined (or not) before #including user_config.hpp, the header user_config.hpp is cached with that definition for good even when PARAM_PREFIX or PARAM_DEFAULT changes definition.
The fix would be to avoid this mechanism, splitting into proper header (with extern, without definition) and source code (without extern, with definition). This is unwanted duplication but standard code in the C/C++ language model. For example in the same file you have
extern UserConfig *user_config;
which is defined elsewhere.
If you fix that and zapcc works without b4c31ccf42145f7032002d27e8e899b5100516c4 (don't forget to pkill zapccs after changing zapccs.config), please let me know and I'll revert the patch. zapcc accelerates even now and such patch will accelerate compilation even more.
If I get it right way, I need separate file with #defines and include it from config/user_config.hpp
. Am I right?
You need to seperate declaration and definition of these variables exactly like user_config
or logMemory
:
user_config.hpp
namespace UserConfigParams
{
extern GroupUserConfigParam m_audio_group;
extern BoolUserConfigParam m_sfx;
...
bool logMemory();
}
extern UserConfig *user_config;
user_config.cpp
namespace UserConfigParams
{
GroupUserConfigParam m_audio_group( GroupUserConfigParam("Audio", "Audio Settings") );
BoolUserConfigParam m_sfx( BoolUserConfigParam(true, "sfx_on", &m_audio_group,
"Whether sound effects are enabled or not (true or false)") );
...
}
bool UserConfigParams::logMemory()
{ return (m_verbosity&LOG_MEMORY) == LOG_MEMORY;}
UserConfig *user_config;
I try to build https://github.com/supertuxkart/stk-code.git with
zapcc
.My cmake command:
It fails on last step (
[100%] Linking CXX executable bin/supertuxkart
):Everything is fine when I use clang or gcc.