Skip to content

Commit

Permalink
move -Wno-c99-designator and -Wno-c++20-designator to source file
Browse files Browse the repository at this point in the history
  • Loading branch information
oathdruid committed Aug 6, 2024
1 parent ea8c52b commit 6cca06b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 33 deletions.
7 changes: 2 additions & 5 deletions src/babylon/any.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include "babylon/any.h"

#pragma clang diagnostic push
#if __clang__
#pragma clang diagnostic ignored "-Wc++20-designator"
#endif // __clang__
#include "babylon/protect.h"

BABYLON_NAMESPACE_BEGIN

Expand Down Expand Up @@ -71,4 +68,4 @@ Any& Any::ref(const Descriptor* descriptor, void* instance) noexcept {

BABYLON_NAMESPACE_END

#pragma clang diagnostic pop
#include "babylon/unprotect.h"
7 changes: 2 additions & 5 deletions src/babylon/any.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

#include <memory> // std::unique_ptr

#pragma clang diagnostic push
#if __clang__
#pragma clang diagnostic ignored "-Wc++20-designator"
#endif // __clang__
#include "babylon/protect.h"

BABYLON_NAMESPACE_BEGIN

Expand Down Expand Up @@ -308,6 +305,6 @@ class Any {

BABYLON_NAMESPACE_END

#pragma clang diagnostic pop
#include "babylon/unprotect.h"

#include "babylon/any.hpp"
7 changes: 2 additions & 5 deletions src/babylon/any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@

#include <cassert> // ::assert

#pragma clang diagnostic push
#if __clang__
#pragma clang diagnostic ignored "-Wc++20-designator"
#endif // __clang__
#include "babylon/protect.h"

BABYLON_NAMESPACE_BEGIN

Expand Down Expand Up @@ -476,4 +473,4 @@ inline ::std::unique_ptr<void, void (*)(void*)> Any::release() noexcept {

BABYLON_NAMESPACE_END

#pragma clang diagnostic pop
#include "babylon/unprotect.h"
7 changes: 2 additions & 5 deletions src/babylon/logging/async_file_appender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
#include <sys/mman.h>
#include <sys/stat.h>

#pragma clang diagnostic push
#if __clang__
#pragma clang diagnostic ignored "-Wc++20-designator"
#endif // __clang__
#include "babylon/protect.h"

BABYLON_NAMESPACE_BEGIN

Expand Down Expand Up @@ -149,4 +146,4 @@ void AsyncFileAppender::write_use_plain_writev(Destination& dest,

BABYLON_NAMESPACE_END

#pragma clang diagnostic pop
#include "babylon/unprotect.h"
7 changes: 2 additions & 5 deletions src/babylon/logging/log_entry.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#include "babylon/logging/log_entry.h"

#pragma clang diagnostic push
#if __clang__
#pragma clang diagnostic ignored "-Wc++20-designator"
#endif // __clang__
#include "babylon/protect.h"

BABYLON_NAMESPACE_BEGIN

Expand Down Expand Up @@ -120,4 +117,4 @@ void LogStreamBuffer::overflow_page_table() noexcept {

BABYLON_NAMESPACE_END

#pragma clang diagnostic pop
#include "babylon/unprotect.h"
9 changes: 4 additions & 5 deletions src/babylon/logging/log_severity.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "babylon/string_view.h" // StringView

#include "babylon/protect.h"

BABYLON_NAMESPACE_BEGIN

class LogSeverity {
Expand Down Expand Up @@ -33,17 +35,12 @@ class LogSeverity {
private:
int8_t _value {DEBUG};

#pragma clang diagnostic push
#if __clang__
#pragma clang diagnostic ignored "-Wc99-designator"
#endif // __clang__
static constexpr StringView names[NUM] = {
[DEBUG] = "DEBUG",
[INFO] = "INFO",
[WARNING] = "WARNING",
[FATAL] = "FATAL",
};
#pragma clang diagnostic pop
};

inline constexpr LogSeverity::LogSeverity(int8_t value) noexcept
Expand All @@ -64,3 +61,5 @@ inline ::std::basic_ostream<C, T>& operator<<(::std::basic_ostream<C, T>& os,
}

BABYLON_NAMESPACE_END

#include "babylon/unprotect.h"
5 changes: 5 additions & 0 deletions src/babylon/protect.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
#pragma push_macro("F")
#undef F

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wunknown-warning-option"
#pragma GCC diagnostic ignored "-Wc99-designator"

#else // BAIDU_PROTECT_H
#error("protect.h without unprotect.h")
#endif // BAIDU_PROTECT_H
2 changes: 2 additions & 0 deletions src/babylon/unprotect.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@
// 例如baidu/feed-mlarch/feature-extract-framework中定义了F
#pragma pop_macro("F")

#pragma GCC diagnostic pop

#endif // BABYLON_UNPROTECT_H
5 changes: 2 additions & 3 deletions test/concurrent/test_sched_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

#include <future> // ::std::async

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc++20-designator"
#include "babylon/protect.h"

using ::babylon::Futex;
using ::babylon::SchedInterface;
Expand Down Expand Up @@ -199,4 +198,4 @@ TEST(futex_interface, futex_value_read_write_as_atomic) {
}
}

#pragma clang diagnostic pop
#include "babylon/unprotect.h"

0 comments on commit 6cca06b

Please sign in to comment.