aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/nss/nss/disable-Wvarargs-with-clang.patch
blob: 4c9bea30c0c7b9108a9b60dbbff817066a4b6be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From f613c9a9107435a40d91329f33f12cfb16927f07 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 7 Mar 2020 08:34:02 -0800
Subject: [PATCH] nss,nspr: Add recipes

clang 3.9 add this warning to rightly flag undefined
behavior, we relegate this to be just a warning instead
of error and keep the behavior as it was. Right fix would
be to not pass enum to the function with variadic arguments
as last named argument

Fixes errors like
ocsp.c:2220:22: error: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs]
        va_start(ap, responseType0);
                     ^
ocsp.c:2200:43: note: parameter of type 'SECOidTag' is declared here
                                SECOidTag responseType0, ...)

see
https://www.securecoding.cert.org/confluence/display/cplusplus/EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start
for more details

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending

---
 nss/coreconf/Werror.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nss/coreconf/Werror.mk b/nss/coreconf/Werror.mk
index a569a49..687fe58 100644
--- a/nss/coreconf/Werror.mk
+++ b/nss/coreconf/Werror.mk
@@ -56,7 +56,7 @@ ifndef WARNING_CFLAGS
     ifdef CC_IS_CLANG
       # -Qunused-arguments : clang objects to arguments that it doesn't understand
       #    and fixing this would require rearchitecture
-      WARNING_CFLAGS += -Qunused-arguments
+      WARNING_CFLAGS += -Qunused-arguments -Wno-error=varargs
       # -Wno-parentheses-equality : because clang warns about macro expansions
       WARNING_CFLAGS += $(call disable_warning,parentheses-equality)
       ifdef BUILD_OPT