def err_pp_eof_in_arc_cf_code_audited : Error<
"'#pragma clang arc_cf_code_audited' was not ended within this file">;
+def warn_pp_date_time : Warning<
+ "expansion of date or time macro is not reproducible">,
+ DefaultIgnore, InGroup<DiagGroup<"date-time">>;
+
// Module map parsing
def err_mmap_unknown_token : Error<"skipping stray token">;
def err_mmap_expected_module : Error<"expected module declaration">;
}
Tok.setKind(tok::string_literal);
} else if (II == Ident__DATE__) {
+ Diag(Tok.getLocation(), diag::warn_pp_date_time);
if (!DATELoc.isValid())
ComputeDATE_TIME(DATELoc, TIMELoc, *this);
Tok.setKind(tok::string_literal);
Tok.getLength()));
return;
} else if (II == Ident__TIME__) {
+ Diag(Tok.getLocation(), diag::warn_pp_date_time);
if (!TIMELoc.isValid())
ComputeDATE_TIME(DATELoc, TIMELoc, *this);
Tok.setKind(tok::string_literal);
OS << Depth;
Tok.setKind(tok::numeric_constant);
} else if (II == Ident__TIMESTAMP__) {
+ Diag(Tok.getLocation(), diag::warn_pp_date_time);
// MSVC, ICC, GCC, VisualAge C++ extension. The generated string should be
// of the form "Ddd Mmm dd hh::mm::ss yyyy", which is returned by asctime.
Result = "??? ??? ?? ??:??:?? ????\n";
}
// Surround the string with " and strip the trailing newline.
- OS << '"' << StringRef(Result, strlen(Result)-1) << '"';
+ OS << '"' << StringRef(Result).drop_back() << '"';
Tok.setKind(tok::string_literal);
} else if (II == Ident__COUNTER__) {
// __COUNTER__ expands to a simple numeric value.
--- /dev/null
+// RUN: %clang_cc1 -Wdate-time -Wno-builtin-macro-redefined %s -verify -E
+
+__TIME__ // expected-warning {{expansion of date or time macro is not reproducible}}
+__DATE__ // expected-warning {{expansion of date or time macro is not reproducible}}
+__TIMESTAMP__ // expected-warning {{expansion of date or time macro is not reproducible}}
+
+#define __TIME__
+__TIME__