Skip to content

Commit ee86989

Browse files
committed
fix fallthrough attribute
1 parent cc3fe35 commit ee86989

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

data-raw/update-absl.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,8 @@ usethis::edit_file("src/absl/container/internal/raw_hash_set.h")
159159
# CRAN compiles with -Wpedantic, so we can't use the __int128 intrinsic type
160160
# undefine ABSL_HAVE_INTRINSIC_INT128 here:
161161
usethis::edit_file("src/absl/base/config.h")
162+
163+
# The use of ABSL_HAVE_CPP_ATTRIBUTE() with ABSL_FALLTHROUGH_INTENDED
164+
# here uses C++17 attributes even if -std=c++17 is not set,
165+
# which causes CRAN warnings with -Wpedantic
166+
usethis::edit_file("src/absl/base/attributes.h")

src/absl/base/attributes.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -629,19 +629,21 @@
629629
// no effect on diagnostics. In any case this macro has no effect on runtime
630630
// behavior and performance of code.
631631

632-
#ifdef ABSL_FALLTHROUGH_INTENDED
633-
#error "ABSL_FALLTHROUGH_INTENDED should not be defined."
634-
#elif ABSL_HAVE_CPP_ATTRIBUTE(fallthrough)
635-
#define ABSL_FALLTHROUGH_INTENDED [[fallthrough]]
636-
#elif ABSL_HAVE_CPP_ATTRIBUTE(clang::fallthrough)
637-
#define ABSL_FALLTHROUGH_INTENDED [[clang::fallthrough]]
638-
#elif ABSL_HAVE_CPP_ATTRIBUTE(gnu::fallthrough)
639-
#define ABSL_FALLTHROUGH_INTENDED [[gnu::fallthrough]]
640-
#else
632+
// The use of ABSL_HAVE_CPP_ATTRIBUTE() here uses C++17 attributes
633+
// even if -std=c++17 is not set, which does not work with -Wpedantic on R
634+
// #ifdef ABSL_FALLTHROUGH_INTENDED
635+
// #error "ABSL_FALLTHROUGH_INTENDED should not be defined."
636+
// #elif ABSL_HAVE_CPP_ATTRIBUTE(fallthrough)
637+
// #define ABSL_FALLTHROUGH_INTENDED [[fallthrough]]
638+
// #elif ABSL_HAVE_CPP_ATTRIBUTE(clang::fallthrough)
639+
// #define ABSL_FALLTHROUGH_INTENDED [[clang::fallthrough]]
640+
// #elif ABSL_HAVE_CPP_ATTRIBUTE(gnu::fallthrough)
641+
// #define ABSL_FALLTHROUGH_INTENDED [[gnu::fallthrough]]
642+
// #else
641643
#define ABSL_FALLTHROUGH_INTENDED \
642644
do { \
643645
} while (0)
644-
#endif
646+
// #endif
645647

646648
// ABSL_DEPRECATED()
647649
//

0 commit comments

Comments
 (0)