Why doesn't Clang like the __DATE__ macro?
Clash Royale CLAN TAG#URR8PPP
up vote
6
down vote
favorite
I use the __DATE__
macro for getting a compile-time year:
const QString build_year = __DATE__ + 7;
The Clang Code Model in QtCreator throws a -Wdate-time
warning for using the __DATE__
macro.
warning: expansion of date or time macro is not reproducible
I can disable this warning with -Wno-date-time
, but what is wrong with using __DATE__
?
What is an "expansion" of the macro, how can it be "reproducible" or "not reproducible", and why is "not reproducible" bad?
c++ clang qt-creator
add a comment |Â
up vote
6
down vote
favorite
I use the __DATE__
macro for getting a compile-time year:
const QString build_year = __DATE__ + 7;
The Clang Code Model in QtCreator throws a -Wdate-time
warning for using the __DATE__
macro.
warning: expansion of date or time macro is not reproducible
I can disable this warning with -Wno-date-time
, but what is wrong with using __DATE__
?
What is an "expansion" of the macro, how can it be "reproducible" or "not reproducible", and why is "not reproducible" bad?
c++ clang qt-creator
1
The builds are going to be different depending on when you build it (because the date is different).
â CoffeeTableEspresso
1 hour ago
I don't believeclang++
enables-Wdate-time
by default (I just tried it on my system and I don't get the warning unless I enable it explicitly). Does QtCreator enable it for you? Or make a Makefile or equivalent? You shouldn't get that warning unless something asks for it.
â Keith Thompson
1 hour ago
1
@KeithThompson default clang scheme in the QTCreator is "Clang-only checks for almost everything" --Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-unused-macros -Wno-newline-eof -Wno-exit-time-destructors -Wno-global-constructors -Wno-gnu-zero-variadic-macro-arguments -Wno-documentation -Wno-shadow -Wno-switch-enum -Wno-missing-prototypes -Wno-used-but-marked-unused
â yalov
1 hour ago
@yalov: It's the-Weverything
that enables-Wdate-time
.
â Keith Thompson
1 hour ago
add a comment |Â
up vote
6
down vote
favorite
up vote
6
down vote
favorite
I use the __DATE__
macro for getting a compile-time year:
const QString build_year = __DATE__ + 7;
The Clang Code Model in QtCreator throws a -Wdate-time
warning for using the __DATE__
macro.
warning: expansion of date or time macro is not reproducible
I can disable this warning with -Wno-date-time
, but what is wrong with using __DATE__
?
What is an "expansion" of the macro, how can it be "reproducible" or "not reproducible", and why is "not reproducible" bad?
c++ clang qt-creator
I use the __DATE__
macro for getting a compile-time year:
const QString build_year = __DATE__ + 7;
The Clang Code Model in QtCreator throws a -Wdate-time
warning for using the __DATE__
macro.
warning: expansion of date or time macro is not reproducible
I can disable this warning with -Wno-date-time
, but what is wrong with using __DATE__
?
What is an "expansion" of the macro, how can it be "reproducible" or "not reproducible", and why is "not reproducible" bad?
c++ clang qt-creator
c++ clang qt-creator
edited 9 mins ago
Boann
36k1286116
36k1286116
asked 1 hour ago
yalov
12718
12718
1
The builds are going to be different depending on when you build it (because the date is different).
â CoffeeTableEspresso
1 hour ago
I don't believeclang++
enables-Wdate-time
by default (I just tried it on my system and I don't get the warning unless I enable it explicitly). Does QtCreator enable it for you? Or make a Makefile or equivalent? You shouldn't get that warning unless something asks for it.
â Keith Thompson
1 hour ago
1
@KeithThompson default clang scheme in the QTCreator is "Clang-only checks for almost everything" --Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-unused-macros -Wno-newline-eof -Wno-exit-time-destructors -Wno-global-constructors -Wno-gnu-zero-variadic-macro-arguments -Wno-documentation -Wno-shadow -Wno-switch-enum -Wno-missing-prototypes -Wno-used-but-marked-unused
â yalov
1 hour ago
@yalov: It's the-Weverything
that enables-Wdate-time
.
â Keith Thompson
1 hour ago
add a comment |Â
1
The builds are going to be different depending on when you build it (because the date is different).
â CoffeeTableEspresso
1 hour ago
I don't believeclang++
enables-Wdate-time
by default (I just tried it on my system and I don't get the warning unless I enable it explicitly). Does QtCreator enable it for you? Or make a Makefile or equivalent? You shouldn't get that warning unless something asks for it.
â Keith Thompson
1 hour ago
1
@KeithThompson default clang scheme in the QTCreator is "Clang-only checks for almost everything" --Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-unused-macros -Wno-newline-eof -Wno-exit-time-destructors -Wno-global-constructors -Wno-gnu-zero-variadic-macro-arguments -Wno-documentation -Wno-shadow -Wno-switch-enum -Wno-missing-prototypes -Wno-used-but-marked-unused
â yalov
1 hour ago
@yalov: It's the-Weverything
that enables-Wdate-time
.
â Keith Thompson
1 hour ago
1
1
The builds are going to be different depending on when you build it (because the date is different).
â CoffeeTableEspresso
1 hour ago
The builds are going to be different depending on when you build it (because the date is different).
â CoffeeTableEspresso
1 hour ago
I don't believe
clang++
enables -Wdate-time
by default (I just tried it on my system and I don't get the warning unless I enable it explicitly). Does QtCreator enable it for you? Or make a Makefile or equivalent? You shouldn't get that warning unless something asks for it.â Keith Thompson
1 hour ago
I don't believe
clang++
enables -Wdate-time
by default (I just tried it on my system and I don't get the warning unless I enable it explicitly). Does QtCreator enable it for you? Or make a Makefile or equivalent? You shouldn't get that warning unless something asks for it.â Keith Thompson
1 hour ago
1
1
@KeithThompson default clang scheme in the QTCreator is "Clang-only checks for almost everything" -
-Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-unused-macros -Wno-newline-eof -Wno-exit-time-destructors -Wno-global-constructors -Wno-gnu-zero-variadic-macro-arguments -Wno-documentation -Wno-shadow -Wno-switch-enum -Wno-missing-prototypes -Wno-used-but-marked-unused
â yalov
1 hour ago
@KeithThompson default clang scheme in the QTCreator is "Clang-only checks for almost everything" -
-Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-unused-macros -Wno-newline-eof -Wno-exit-time-destructors -Wno-global-constructors -Wno-gnu-zero-variadic-macro-arguments -Wno-documentation -Wno-shadow -Wno-switch-enum -Wno-missing-prototypes -Wno-used-but-marked-unused
â yalov
1 hour ago
@yalov: It's the
-Weverything
that enables -Wdate-time
.â Keith Thompson
1 hour ago
@yalov: It's the
-Weverything
that enables -Wdate-time
.â Keith Thompson
1 hour ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
9
down vote
accepted
Having repeated builds reproduce binary-identical outputs is desirable from many points of view. Building identical source code from identical tool chains giving different binaries each time could hide serious problems.
If you don't need to produce identical binaries every time you build identical code just disable that warning. that's why the command-line switch exists.
1
nice concise answer.
â CoffeeTableEspresso
1 hour ago
add a comment |Â
up vote
1
down vote
The warning message tells you why. Using the macro does not result in a reproducible build since its value will change over time. A build in 2018 and one in 2019 will not produce the same binary.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
9
down vote
accepted
Having repeated builds reproduce binary-identical outputs is desirable from many points of view. Building identical source code from identical tool chains giving different binaries each time could hide serious problems.
If you don't need to produce identical binaries every time you build identical code just disable that warning. that's why the command-line switch exists.
1
nice concise answer.
â CoffeeTableEspresso
1 hour ago
add a comment |Â
up vote
9
down vote
accepted
Having repeated builds reproduce binary-identical outputs is desirable from many points of view. Building identical source code from identical tool chains giving different binaries each time could hide serious problems.
If you don't need to produce identical binaries every time you build identical code just disable that warning. that's why the command-line switch exists.
1
nice concise answer.
â CoffeeTableEspresso
1 hour ago
add a comment |Â
up vote
9
down vote
accepted
up vote
9
down vote
accepted
Having repeated builds reproduce binary-identical outputs is desirable from many points of view. Building identical source code from identical tool chains giving different binaries each time could hide serious problems.
If you don't need to produce identical binaries every time you build identical code just disable that warning. that's why the command-line switch exists.
Having repeated builds reproduce binary-identical outputs is desirable from many points of view. Building identical source code from identical tool chains giving different binaries each time could hide serious problems.
If you don't need to produce identical binaries every time you build identical code just disable that warning. that's why the command-line switch exists.
answered 1 hour ago
Stephen M. Webb
67927
67927
1
nice concise answer.
â CoffeeTableEspresso
1 hour ago
add a comment |Â
1
nice concise answer.
â CoffeeTableEspresso
1 hour ago
1
1
nice concise answer.
â CoffeeTableEspresso
1 hour ago
nice concise answer.
â CoffeeTableEspresso
1 hour ago
add a comment |Â
up vote
1
down vote
The warning message tells you why. Using the macro does not result in a reproducible build since its value will change over time. A build in 2018 and one in 2019 will not produce the same binary.
add a comment |Â
up vote
1
down vote
The warning message tells you why. Using the macro does not result in a reproducible build since its value will change over time. A build in 2018 and one in 2019 will not produce the same binary.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
The warning message tells you why. Using the macro does not result in a reproducible build since its value will change over time. A build in 2018 and one in 2019 will not produce the same binary.
The warning message tells you why. Using the macro does not result in a reproducible build since its value will change over time. A build in 2018 and one in 2019 will not produce the same binary.
answered 1 hour ago
Jesper Juhl
14.8k32142
14.8k32142
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52897563%2fwhy-doesnt-clang-like-the-date-macro%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
The builds are going to be different depending on when you build it (because the date is different).
â CoffeeTableEspresso
1 hour ago
I don't believe
clang++
enables-Wdate-time
by default (I just tried it on my system and I don't get the warning unless I enable it explicitly). Does QtCreator enable it for you? Or make a Makefile or equivalent? You shouldn't get that warning unless something asks for it.â Keith Thompson
1 hour ago
1
@KeithThompson default clang scheme in the QTCreator is "Clang-only checks for almost everything" -
-Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-unused-macros -Wno-newline-eof -Wno-exit-time-destructors -Wno-global-constructors -Wno-gnu-zero-variadic-macro-arguments -Wno-documentation -Wno-shadow -Wno-switch-enum -Wno-missing-prototypes -Wno-used-but-marked-unused
â yalov
1 hour ago
@yalov: It's the
-Weverything
that enables-Wdate-time
.â Keith Thompson
1 hour ago