Skip to contentSkip to conversation

perf trace: Avoid compile error wrt redefining bool

PATCH Applied Ian Rogers 2 participants 2 messages Sep 13, 2023 – Sep 17, 2023

Subsystems (2)
lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf trace: Avoid compile error wrt redefining bool

Make part of an existing TODO conditional to avoid the following build error:

```
tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c:26:14: error: cannot combine with previous 'char' declaration specifier
   26 | typedef char bool;
      |              ^
include/stdbool.h:20:14: note: expanded from macro 'bool'
   20 | #define bool _Bool
      |              ^
tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c:26:1: error: typedef requires a name [-Werror,-Wmissing-declarations]
   26 | typedef char bool;
      | ^~~~~~~~~~~~~~~~~
2 errors generated.
```
---
 tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c +2 -0
index 90ce22f9c1a9..939ec769bf4a 100644
@@ -23,7 +23,9 @@
 #define MAX_CPUS  4096
 
 // FIXME: These should come from system headers
+#ifndef bool
 typedef char bool;
+#endif
 typedef int pid_t;
 typedef long long int __s64;
 typedef __s64 time64_t;
Signature · 1 line
2.42.0.283.g2d96d420d3-goog
maintainer Applied
#1 lore raw
Quoted 16 lines · Ian Rogers

Make part of an existing TODO conditional to avoid the following build error:

```
tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c:26:14: error: cannot combine with previous 'char' declaration specifier
   26 | typedef char bool;
      |              ^
include/stdbool.h:20:14: note: expanded from macro 'bool'
   20 | #define bool _Bool
      |              ^
tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c:26:1: error: typedef requires a name [-Werror,-Wmissing-declarations]
   26 | typedef char bool;
      | ^~~~~~~~~~~~~~~~~
2 errors generated.
```
Quoted 1 line

Applied to perf-tools, thanks!

Namhyung