Page MenuHomeFreeBSD

Enable -Wdate-time warning by default with Clang
AcceptedPublic

Authored by emaste on Mon, Apr 5, 12:47 AM.

Details

Reviewers
jhb
markj
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

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

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

This revision is now accepted and ready to land.Mon, Apr 5, 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