Page MenuHomeFreeBSD

Enable -Wdate-time warning by default with Clang
ClosedPublic

Authored by emaste on Apr 5 2021, 12:47 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 3:17 AM
Unknown Object (File)
Sun, Dec 15, 11:39 AM
Unknown Object (File)
Dec 4 2024, 7:32 PM
Unknown Object (File)
Nov 28 2024, 8:51 AM
Unknown Object (File)
Nov 21 2024, 3:39 PM
Unknown Object (File)
Nov 18 2024, 9:26 AM
Unknown Object (File)
Nov 16 2024, 8:59 AM
Unknown Object (File)
Nov 16 2024, 8:13 AM
Subscribers

Details

Summary

This produces an "expansion of date or time macro is not reproducible" warning or error upon use of DATE or TIME.

Add to CWARNFLAGS.clang as older GCC versions (without support for the flag) are still used to build FreeBSD. (This was true when I first created this patch, unsure if it still is.)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Seems reasonable. I do see some usages of these in contrib software though.

This revision is now accepted and ready to land.Apr 5 2021, 2:25 PM

Looks like GCC 6 supports -Wdate-time so I think you can just add this to CWARNFLAGS.

I do see some usages of these in contrib software though.

I'll take another look - I imagine they're either not compiled or at least not with -Werror.

$ git grep -Elw '__DATE__|__TIME__'
contrib/llvm-project/clang/include/clang/Basic/DiagnosticSerializationKinds.td
contrib/llvm-project/clang/include/clang/Lex/Preprocessor.h
contrib/llvm-project/clang/lib/Lex/PPMacroExpansion.cpp
contrib/llvm-project/clang/lib/Serialization/ASTWriter.cpp
contrib/llvm-project/openmp/runtime/src/kmp_stats.cpp
contrib/ntp/include/ntp_calendar.h
contrib/ntp/libntp/ntp_calendar.c
contrib/ofed/opensm/opensm/osm_console.c
contrib/subversion/subversion/include/svn_version.h
contrib/subversion/subversion/libsvn_subr/win32_crashrpt.c
stand/ficl/testmain.c
sys/contrib/dev/acpica/changes.txt
sys/contrib/dev/acpica/compiler/aslcompiler.l
sys/contrib/dev/acpica/compiler/aslparseop.c
sys/contrib/dev/acpica/include/acapps.h
tools/tools/netmap/bridge.c
This revision was automatically updated to reflect the committed changes.
emaste updated this revision to Diff 103015.

add opt-out

add opt-out

Isn't it an opt-in?

This revision is now accepted and ready to land.Feb 22 2022, 3:37 PM
This revision was automatically updated to reflect the committed changes.