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)
Wed, Nov 6, 3:43 AM
Unknown Object (File)
Fri, Oct 25, 12:39 AM
Unknown Object (File)
Fri, Oct 25, 12:39 AM
Unknown Object (File)
Fri, Oct 25, 12:39 AM
Unknown Object (File)
Fri, Oct 25, 12:38 AM
Unknown Object (File)
Fri, Oct 25, 12:38 AM
Unknown Object (File)
Fri, Oct 25, 12:38 AM
Unknown Object (File)
Fri, Oct 25, 12:19 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.