Fix caching of files using wx headers with ccache
Avoid using, or even mentioning in the comments, __DATE__ and __TIME__ macros as doing this prevents ccache from caching the compilation results by default (i.e. unless CCACHE_SLOPPINESS=time_macros is used). As ccache simply scans for the given literal strings, using "##" token pasting operator is enough to disable this pessimization. Of course, this does mean that using ccache with the code actually using __TDATE__ or __TTIME__ is not going to work correctly, but there should be no reason to do it any longer and these macros are not even documented, so also mention that they shouldn't be used. Finally do add __DATE__ to the only place in our own code where these macros are used to ensure that it is not cached incorrectly. Closes #22156.
This commit is contained in:
@@ -241,17 +241,28 @@
|
||||
/* a helper macro allowing to make another macro Unicode-friendly, see below */
|
||||
#define wxAPPLY_T(x) wxT(x)
|
||||
|
||||
/* Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs */
|
||||
/*
|
||||
Unicode-friendly analogs of the standard __FILE__, DATE and TIME macros.
|
||||
|
||||
These macros exist only for backwards compatibility, there should be no
|
||||
reason to use them in the new code, just use the standard macros instead.
|
||||
|
||||
Also note that we must not use the actual macro names for the two latter
|
||||
ones, as doing this would prevent ccache from caching the results of
|
||||
compiling any file including this header by default, rendering ccache
|
||||
ineffective for wxWidgets programs. Hence the use of "##" below and avoiding
|
||||
naming these macros in this comment.
|
||||
*/
|
||||
#ifndef __TFILE__
|
||||
#define __TFILE__ wxAPPLY_T(__FILE__)
|
||||
#endif
|
||||
|
||||
#ifndef __TDATE__
|
||||
#define __TDATE__ wxAPPLY_T(__DATE__)
|
||||
#define __TDATE__ wxAPPLY_T(__ ## DATE__)
|
||||
#endif
|
||||
|
||||
#ifndef __TTIME__
|
||||
#define __TTIME__ wxAPPLY_T(__TIME__)
|
||||
#define __TTIME__ wxAPPLY_T(__ ## TIME__)
|
||||
#endif
|
||||
|
||||
#endif /* _WX_WXCHARTYPE_H_ */
|
||||
|
||||
Reference in New Issue
Block a user