diff mbox series

[bpf-next,2/3] libbpf: compile libbpf under -O2 level by default and catch extra warnings

Message ID 20200929220604.833631-2-andriin@fb.com
State New
Headers show
Series [bpf-next,1/3] libbpf: fix uninitialized variable in btf_parse_type_sec | expand

Commit Message

Andrii Nakryiko Sept. 29, 2020, 10:06 p.m. UTC
For some reason compiler doesn't complain about uninitialized variable, fixed
in previous patch, if libbpf is compiled without -O2 optimization level. So do
compile it with -O2 and never let similar issue slip by again. -Wall is added
unconditionally, so no need to specify it again.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 tools/lib/bpf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin KaFai Lau Sept. 30, 2020, 12:03 a.m. UTC | #1
On Tue, Sep 29, 2020 at 03:06:03PM -0700, Andrii Nakryiko wrote:
> For some reason compiler doesn't complain about uninitialized variable, fixed

> in previous patch, if libbpf is compiled without -O2 optimization level. So do

> compile it with -O2 and never let similar issue slip by again. -Wall is added

> unconditionally, so no need to specify it again.

Acked-by: Martin KaFai Lau <kafai@fb.com>
diff mbox series

Patch

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index f43249696d9f..70cb44efe8cb 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -98,7 +98,7 @@  PC_FILE		= libbpf.pc
 ifdef EXTRA_CFLAGS
   CFLAGS := $(EXTRA_CFLAGS)
 else
-  CFLAGS := -g -Wall
+  CFLAGS := -g -O2
 endif
 
 # Append required CFLAGS