You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tweak macros passed on command line to avoid confusing lit on Windows
On at least Windows, the `%s` in the macros passed on the command line
for the tests are being replaced with the filename for the test. Let's
try to avoid that by removing the `%` prefix from all the test macros.
This makes them consistent with the <inttypes.h> macros too.
// These need PRI and __PRI prefixes so that the check get as far as looking for
132
132
// where the macro comes from.
133
-
#definePRI_FMT_MACRO"%s"
134
-
#define__PRI_FMT_MACRO"%s"
133
+
#definePRI_FMT_MACRO"s"
134
+
#define__PRI_FMT_MACRO"s"
135
135
136
-
auto s6 = absl::StrFormat("Unreplaceable macro at end " PRI_FMT_MACRO, s.c_str());
136
+
auto s6 = absl::StrFormat("Unreplaceable macro at end %" PRI_FMT_MACRO, s.c_str());
137
137
// CHECK-MESSAGES: [[@LINE-1]]:13: warning: unable to use 'std::format' instead of 'StrFormat' because format string contains unreplaceable macro 'PRI_FMT_MACRO' [modernize-use-std-format]
138
138
139
-
auto s7 = absl::StrFormat(__PRI_FMT_MACRO " Unreplaceable macro at beginning", s);
139
+
auto s7 = absl::StrFormat(__PRI_FMT_MACRO " Unreplaceable macro at beginning %s", s);
140
140
// CHECK-MESSAGES: [[@LINE-1]]:13: warning: unable to use 'std::format' instead of 'StrFormat' because format string contains unreplaceable macro '__PRI_FMT_MACRO' [modernize-use-std-format]
141
141
142
-
auto s8 = absl::StrFormat("Unreplacemable macro " PRI_FMT_MACRO " in the middle", s);
142
+
auto s8 = absl::StrFormat("Unreplacemable macro %" PRI_FMT_MACRO " in the middle", s);
143
143
// CHECK-MESSAGES: [[@LINE-1]]:13: warning: unable to use 'std::format' instead of 'StrFormat' because format string contains unreplaceable macro 'PRI_FMT_MACRO' [modernize-use-std-format]
144
144
145
-
auto s9 = absl::StrFormat("First macro is replaceable %" PRIu64 " but second one is not " __PRI_FMT_MACRO, u64, s);
145
+
auto s9 = absl::StrFormat("First macro is replaceable %" PRIu64 " but second one is not %" __PRI_FMT_MACRO, u64, s);
146
146
// CHECK-MESSAGES: [[@LINE-1]]:13: warning: unable to use 'std::format' instead of 'StrFormat' because format string contains unreplaceable macro '__PRI_FMT_MACRO' [modernize-use-std-format]
147
147
148
148
// Needs a PRI prefix so that we get as far as looking for where the macro comes from
149
-
auto s10 = absl::StrFormat(" macro from command line " PRI_CMDLINE_MACRO, s);
149
+
auto s10 = absl::StrFormat(" macro from command line %" PRI_CMDLINE_MACRO, s);
150
150
// CHECK-MESSAGES: [[@LINE-1]]:14: warning: unable to use 'std::format' instead of 'StrFormat' because format string contains unreplaceable macro 'PRI_CMDLINE_MACRO' [modernize-use-std-format]
151
151
152
152
// Needs a __PRI prefix so that we get as far as looking for where the macro comes from
153
-
auto s11 = absl::StrFormat(" macro from command line " __PRI_CMDLINE_MACRO, s);
153
+
auto s11 = absl::StrFormat(" macro from command line %" __PRI_CMDLINE_MACRO, s);
154
154
// CHECK-MESSAGES: [[@LINE-1]]:14: warning: unable to use 'std::format' instead of 'StrFormat' because format string contains unreplaceable macro '__PRI_CMDLINE_MACRO' [modernize-use-std-format]
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: use 'std::println' instead of 'printf' [modernize-use-std-print]
1595
1595
// CHECK-FIXES: std::println("Replaceable macros in middle {} {}", u64, u32);
1596
1596
1597
-
printf("Unreplaceable macro at end " PRI_FMT_MACRO, s);
1597
+
printf("Unreplaceable macro at end %" PRI_FMT_MACRO, s);
1598
1598
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: unable to use 'std::print' instead of 'printf' because format string contains unreplaceable macro 'PRI_FMT_MACRO' [modernize-use-std-print]
1599
1599
1600
-
printf(PRI_FMT_MACRO " Unreplaceable macro at beginning", s);
1600
+
printf(PRI_FMT_MACRO " Unreplaceable macro at beginning %s", s);
1601
1601
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: unable to use 'std::print' instead of 'printf' because format string contains unreplaceable macro 'PRI_FMT_MACRO' [modernize-use-std-print]
1602
1602
1603
-
printf("Unreplacemable macro " __PRI_FMT_MACRO " in the middle", s);
1603
+
printf("Unreplacemable macro %" __PRI_FMT_MACRO " in the middle", s);
1604
1604
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: unable to use 'std::print' instead of 'printf' because format string contains unreplaceable macro '__PRI_FMT_MACRO' [modernize-use-std-print]
1605
1605
1606
-
printf("First macro is replaceable %" PRIu64 " but second one is not " PRI_FMT_MACRO, u64, s);
1606
+
printf("First macro is replaceable %" PRIu64 " but second one is not %" PRI_FMT_MACRO, u64, s);
1607
1607
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: unable to use 'std::print' instead of 'printf' because format string contains unreplaceable macro 'PRI_FMT_MACRO' [modernize-use-std-print]
1608
1608
1609
1609
// Needs a PRI prefix so that we get as far as looking for where the macro comes from
1610
-
printf(" macro from command line " PRI_CMDLINE_MACRO, s);
1610
+
printf(" macro from command line %" PRI_CMDLINE_MACRO, s);
1611
1611
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: unable to use 'std::print' instead of 'printf' because format string contains unreplaceable macro 'PRI_CMDLINE_MACRO' [modernize-use-std-print]
1612
1612
1613
1613
// Needs a __PRI prefix so that we get as far as looking for where the macro comes from
1614
-
printf(" macro from command line " __PRI_CMDLINE_MACRO, s);
1614
+
printf(" macro from command line %" __PRI_CMDLINE_MACRO, s);
1615
1615
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: unable to use 'std::print' instead of 'printf' because format string contains unreplaceable macro '__PRI_CMDLINE_MACRO' [modernize-use-std-print]
0 commit comments