Skip to content

Commit 21bbcce

Browse files
committed
guard include headers with C11 and macro flag
1 parent f9f75a2 commit 21bbcce

File tree

7 files changed

+26
-1
lines changed

7 files changed

+26
-1
lines changed

libc/hdr/types/constraint_handler_t.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#ifndef LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H
1010
#define LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H
1111

12+
#define LIBC_HAS_ANNEX_K
13+
1214
#include "include/llvm-libc-types/constraint_handler_t.h"
1315

16+
#undef LIBC_HAS_ANNEX_K
17+
1418
#endif // LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H

libc/hdr/types/errno_t.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#ifndef LLVM_LIBC_HDR_TYPES_ERRNO_T_H
1010
#define LLVM_LIBC_HDR_TYPES_ERRNO_T_H
1111

12+
#define LIBC_HAS_ANNEX_K
13+
1214
#include "include/llvm-libc-types/errno_t.h"
1315

16+
#undef LIBC_HAS_ANNEX_K
17+
1418
#endif // LLVM_LIBC_HDR_TYPES_ERRNO_T_H

libc/include/llvm-libc-types/constraint_handler_t.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111

1212
#include "errno_t.h"
1313

14+
#ifdef LIBC_HAS_ANNEX_K
15+
1416
typedef void (*constraint_handler_t)(const char *__restrict msg,
1517
void *__restrict ptr, errno_t error);
1618

19+
#endif // LIBC_HAS_ANNEX_K
20+
1721
#endif // LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H

libc/include/llvm-libc-types/errno_t.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#ifndef LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_ERRNO_T_H
1010
#define LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_ERRNO_T_H
1111

12+
#ifdef LIBC_HAS_ANNEX_K
13+
1214
typedef int errno_t;
1315

16+
#endif // LIBC_HAS_ANNEX_K
17+
1418
#endif // LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_ERRNO_T_H

libc/include/llvm-libc-types/rsize_t.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#ifndef LLVM_LIBC_TYPES_RSIZE_T_H
1010
#define LLVM_LIBC_TYPES_RSIZE_T_H
1111

12+
#ifdef LIBC_HAS_ANNEX_K
13+
1214
typedef __SIZE_TYPE__ rsize_t;
1315

16+
#endif // LIBC_HAS_ANNEX_K
17+
1418
#endif // LLVM_LIBC_TYPES_RSIZE_T_H

libc/include/stdlib.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ standards:
55
merge_yaml_files:
66
- stdlib-malloc.yaml
77
macros:
8+
- macro_name: LIBC_HAS_ANNEX_K
9+
macro_header: annex-k-macros.h
810
- macro_name: NULL
911
macro_header: null-macro.h
1012
types:
@@ -189,6 +191,7 @@ functions:
189191
return_type: constraint_handler_t
190192
arguments:
191193
- type: constraint_handler_t
194+
guard: LIBC_HAS_ANNEX_K
192195
- name: abort_handler_s
193196
standards:
194197
- stdc
@@ -197,6 +200,7 @@ functions:
197200
- type: const char *__restrict
198201
- type: void *__restrict
199202
- type: errno_t
203+
guard: LIBC_HAS_ANNEX_K
200204
- name: ignore_handler_s
201205
standards:
202206
- stdc
@@ -205,6 +209,7 @@ functions:
205209
- type: const char *__restrict
206210
- type: void *__restrict
207211
- type: errno_t
212+
guard: LIBC_HAS_ANNEX_K
208213
- name: srand
209214
standards:
210215
- stdc

libc/src/stdio/fopen_s.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define LLVM_LIBC_SRC_STDIO_FOPEN_S_H
1111

1212
#include "hdr/types/FILE.h"
13-
#include "include/llvm-libc-types/errno_t.h"
13+
#include "hdr/types/errno_t.h"
1414
#include "src/__support/macros/config.h"
1515

1616
namespace LIBC_NAMESPACE_DECL {

0 commit comments

Comments
 (0)