Skip to content

Commit 656f805

Browse files
committed
Update basic_csv_parser.cpp
1 parent a0496ac commit 656f805

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

include/internal/basic_csv_parser.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
#include <system_error>
44

5+
// Because g++ wants to be a pedantic little brat about fallthroughs
6+
#ifdef CXX_CSV_HAS_17
7+
#define FALLTHROUGH_TO_NEXT_CASE [[fallthrough]];
8+
#else
9+
#define FALLTHROUGH_TO_NEXT_CASE goto next_newline_case;
10+
#endif
11+
512
namespace csv {
613
namespace internals {
714
CSV_INLINE size_t get_file_size(csv::string_view filename) {
@@ -182,15 +189,10 @@ namespace csv {
182189
this->data_pos_++;
183190
}
184191

185-
#if defined(__GNUC__) || defined(__clang__)
186-
#pragma GCC diagnostic push
187-
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
188-
#endif
192+
FALLTHROUGH_TO_NEXT_CASE
189193

194+
next_newline_case:
190195
case ParseFlags::NEWLINE:
191-
#if defined(__GNUC__) || defined(__clang__)
192-
#pragma GCC diagnostic pop
193-
#endif
194196
this->data_pos_++;
195197

196198
// End of record. Preserve intentional empty fields such as

0 commit comments

Comments
 (0)