Skip to content

Commit 4a9bde3

Browse files
committed
pragma
1 parent 2c19a7d commit 4a9bde3

File tree

7 files changed

+34
-18
lines changed

7 files changed

+34
-18
lines changed

ext/rbs_extension/ast_translation.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
#ifndef RBS_EXTENSION_AST_TRANSLATION_H
99
#define RBS_EXTENSION_AST_TRANSLATION_H
1010

11-
#pragma clang diagnostic push
12-
#pragma clang diagnostic ignored "-Wc2x-extensions"
11+
#include "compat.h"
12+
13+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
1314
#include "ruby.h"
1415
#include "ruby/encoding.h"
15-
#pragma clang diagnostic pop
16+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
1617

1718
#include "rbs/ast.h"
1819
#include "rbs/location.h"

ext/rbs_extension/class_constants.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
#ifndef RBS__CONSTANTS_H
99
#define RBS__CONSTANTS_H
1010

11-
#pragma clang diagnostic push
12-
#pragma clang diagnostic ignored "-Wc2x-extensions"
11+
#include "compat.h"
12+
13+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
1314
#include "ruby.h"
14-
#pragma clang diagnostic pop
15+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
1516

1617
extern VALUE RBS;
1718

ext/rbs_extension/compat.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifdef __clang__
2+
#define SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN \
3+
_Pragma("clang diagnostic push") \
4+
_Pragma("clang diagnostic ignored \"-Wc2x-extensions\"")
5+
#define SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END \
6+
_Pragma("clang diagnostic pop")
7+
#else
8+
#define SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
9+
#define SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
10+
#endif

ext/rbs_extension/legacy_location.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#ifndef RBS_LOCATION_H
22
#define RBS_LOCATION_H
33

4-
#pragma clang diagnostic push
5-
#pragma clang diagnostic ignored "-Wc2x-extensions"
4+
#include "compat.h"
5+
6+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
67
#include "ruby.h"
7-
#pragma clang diagnostic pop
8+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
9+
810
#include "rbs.h"
911

1012
/**

ext/rbs_extension/rbs_extension.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#include <stdbool.h>
2+
#include "compat.h"
23

3-
#pragma clang diagnostic push
4-
#pragma clang diagnostic ignored "-Wc2x-extensions"
4+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
55
#include "ruby.h"
66
#include "ruby/re.h"
77
#include "ruby/encoding.h"
8-
#pragma clang diagnostic pop
8+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
99

1010
#include "class_constants.h"
1111
#include "rbs.h"

templates/ext/rbs_extension/ast_translation.h.erb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#ifndef RBS_EXTENSION_AST_TRANSLATION_H
22
#define RBS_EXTENSION_AST_TRANSLATION_H
33

4-
#pragma clang diagnostic push
5-
#pragma clang diagnostic ignored "-Wc2x-extensions"
4+
#include "compat.h"
5+
6+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
67
#include "ruby.h"
78
#include "ruby/encoding.h"
8-
#pragma clang diagnostic pop
9+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
910

1011
#include "rbs/ast.h"
1112
#include "rbs/location.h"

templates/ext/rbs_extension/class_constants.h.erb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#ifndef RBS__CONSTANTS_H
22
#define RBS__CONSTANTS_H
33

4-
#pragma clang diagnostic push
5-
#pragma clang diagnostic ignored "-Wc2x-extensions"
4+
#include "compat.h"
5+
6+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_BEGIN
67
#include "ruby.h"
7-
#pragma clang diagnostic pop
8+
SUPPRESS_RUBY_HEADER_DIAGNOSTICS_END
89

910
extern VALUE RBS;
1011

0 commit comments

Comments
 (0)