Skip to content

Commit 821b625

Browse files
authored
Merge pull request #59 from well-typed/bolt12/58
Silence `CXRemapping` deprecation from <clang-c> includes
2 parents eacb433 + 7c06869 commit 821b625

4 files changed

Lines changed: 34 additions & 0 deletions

File tree

libclang-bindings/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@
2525

2626
### Bug fixes
2727

28+
* Silence `-Wdeprecated-declarations` warnings emitted by `<clang-c/Index.h>`
29+
on Clang 21 at the system-header include sites only, so that deprecation
30+
warnings for libclang APIs we actually call remain visible. See
31+
[issue #58][issue-58].
32+
2833
[pr-37]: https://github.com/well-typed/libclang/pull/37
2934
[pr-42]: https://github.com/well-typed/libclang/pull/42
3035
[pr-47]: https://github.com/well-typed/libclang/pull/47
3136
[pr-53]: https://github.com/well-typed/libclang/pull/53
37+
[issue-58]: https://github.com/well-typed/libclang/issues/58
3238

3339
## 0.1.0-alpha -- 2026-02-06
3440

libclang-bindings/cbits/clang_wrappers.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#ifndef CLANG_WRAPPERS_H
22
#define CLANG_WRAPPERS_H
33

4+
#include "libclang_version.h"
5+
6+
#if LIBCLANG_VERSION_MAJOR == 21
7+
#pragma GCC diagnostic push
8+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
9+
#endif
410
#include <clang-c/Index.h>
11+
#if LIBCLANG_VERSION_MAJOR == 21
12+
#pragma GCC diagnostic pop
13+
#endif
14+
515
#include <stdio.h>
616
#include "clang_wrappers_ffi.h"
717

libclang-bindings/cbits/doxygen_wrappers.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef DOXYGEN_WRAPPERS_H
22
#define DOXYGEN_WRAPPERS_H
33

4+
#include "libclang_version.h"
5+
46
/**
57
* Wrappers for the Doxygen API
68
*
@@ -17,7 +19,14 @@
1719
* convention for such parameters, while `result` is not capitalized.
1820
*/
1921

22+
#if LIBCLANG_VERSION_MAJOR == 21
23+
#pragma GCC diagnostic push
24+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
25+
#endif
2026
#include <clang-c/Documentation.h>
27+
#if LIBCLANG_VERSION_MAJOR == 21
28+
#pragma GCC diagnostic pop
29+
#endif
2130

2231
/**
2332
* Top-level

libclang-bindings/cbits/rewrite_wrappers.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
#ifndef REWRITE_WRAPPERS_H
22
#define REWRITE_WRAPPERS_H
33

4+
#include "libclang_version.h"
5+
46
/**
57
* Wrappers for the Rewrite API
68
*/
79

10+
#if LIBCLANG_VERSION_MAJOR == 21
11+
#pragma GCC diagnostic push
12+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
13+
#endif
814
#include <clang-c/Rewrite.h>
15+
#if LIBCLANG_VERSION_MAJOR == 21
16+
#pragma GCC diagnostic pop
17+
#endif
918

1019
static inline void wrap_CXRewriter_insertTextBefore(CXRewriter Rew, const CXSourceLocation *Loc, const char *Insert) {
1120
clang_CXRewriter_insertTextBefore(Rew, *Loc, Insert);

0 commit comments

Comments
 (0)