summaryrefslogtreecommitdiff
blob: c4aec2836ba0e10e879cdf690d216754bff1f233 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
https://github.com/royhills/ike-scan/pull/39

From 9949ce4bdf9f4bcb616b2a5d273708a7ea9ee93d Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Mon, 26 Sep 2022 05:22:18 +0100
Subject: [PATCH 1/3] acinclude.m4: fix -Wimplicit-int errors (Clang 16+
 compat)

--- a/acinclude.m4
+++ b/acinclude.m4
@@ -144,7 +144,7 @@ int does_int64_work()
     return 0;
   return 1;
 }
-main() {
+int main() {
   return ! does_int64_work();
 }],
 [Ac_cachevar=yes],
@@ -200,7 +200,7 @@ int does_int64_snprintf_work()
     return 0;			/* either multiply or snprintf is busted */
   return 1;
 }
-main() {
+int main() {
   return ! does_int64_snprintf_work();
 }],
 [pgac_cv_snprintf_long_long_int_format=$pgac_format; break],

From 6a931ca559a937cb9f7917b9131ec1aca4919683 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Mon, 26 Sep 2022 05:23:06 +0100
Subject: [PATCH 2/3] acinclude.m4: fix typo in 'x' if check

Case doesn't matter but case does need to match on left & right
hand side, so just choose uppercase everywhere to match what
the rest of the file does.
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -278,7 +278,7 @@ dnl in <features.h>. We don't use __GNUC_PREREQ directly because <features.h>
 dnl is not present on all the operating systems that we support, e.g. OpenBSD.
 dnl
 AC_DEFUN([GCC_FORTIFY_SOURCE],[
-   if test "x$CC" != "X"; then
+   if test "X$CC" != "X"; then
       AC_MSG_CHECKING([whether ${CC} accepts -D_FORTIFY_SOURCE])
       AC_TRY_COMPILE(,[
          #define GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
@@ -311,7 +311,7 @@ dnl If it is not supported, then the test program will compile without
 dnl warnings.
 dnl
 AC_DEFUN([GCC_FORMAT_SECURITY],[
-   if test "x$CC" != "X"; then
+   if test "X$CC" != "X"; then
       AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security])
       wfs_old_cflags="$CFLAGS"
       CFLAGS="$CFLAGS -Wall -Werror -Wformat -Wformat-security"

From fbc40c7b117b523eceb9aa58d6086bde701f1299 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 1 Oct 2022 01:24:04 +0100
Subject: [PATCH 3/3] configure.ac: Fix recognising -Wformat-security with
 Clang

Before:
```
checking whether clang accepts -fstack-protector... yes
checking whether clang accepts -D_FORTIFY_SOURCE... yes
checking whether clang accepts -Wformat-security... no
```

After:
```
checking whether clang accepts -fstack-protector... yes
checking whether clang accepts -Wformat-security... yes
checking whether clang accepts -D_FORTIFY_SOURCE... yes
```

Signed-off-by: Sam James <sam@gentoo.org>
--- a/configure.ac
+++ b/configure.ac
@@ -34,8 +34,8 @@ if test -n "$GCC"; then
    CFLAGS="$CFLAGS -Wall -Wshadow -Wwrite-strings"
    GCC_WEXTRA
    GCC_STACK_PROTECT_CC
-   GCC_FORTIFY_SOURCE
    GCC_FORMAT_SECURITY
+   GCC_FORTIFY_SOURCE
 dnl Uncomment the lines below for testing with stricter warnings.
 dnl CFLAGS="$CFLAGS -pedantic -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline "
 dnl Uncomment the line below to check malloc/free with electric fence