Skip to contentSkip to conversation

package/faketime: fix build with gcc >= 6

PATCH New Romain Naour 2 participants 5 messages May 14, 2017 – May 17, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/faketime: fix build with gcc >= 6

Upstream added -Wno-nonnull-compare to disable this error [1].

Fixes:
libfaketime.c:513:7: error?: nonnull argument ??buf?? compared to NULL [-Werror=nonnull-compare]

    if (buf != NULL)
       ^

[1] https://github.com/wolfcw/libfaketime/commit/47e958b753fc15098a2b7d0e9ef26b83ee255874

---
 ...isable-the-non-null-compare-warning-error.patch | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 package/faketime/0001-Disable-the-non-null-compare-warning-error.patch
package/faketime/0001-Disable-the-non-null-compare-warning-error.patch new file +31 -0
new file mode 100644
index 0000000..859592e
@@ -0,0 +1,31 @@
+From e85a157b51b1276c91c736d8624d9f3e876e9189 Mon Sep 17 00:00:00 2001
+From: Andreas Rammhold <[email protected]>
+Date: Tue, 20 Dec 2016 19:25:32 +0100
+Subject: [PATCH] Disable the non-null compare warning/error.
+
+We rely on the provided local library definitions for the hooked
+functions which in some cases (GCC >6) carry a non-null-attribute flag
+which causes compile errors on `!= NULL` checks.
+
+[Romain: rebase on 0.9.6]
+Signed-off-by: Romain Naour <[email protected]>
+---
+ src/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index 51634b0..bbbd476 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -67,7 +67,7 @@ INSTALL ?= install
+ PREFIX ?= /usr/local
+ LIBDIRNAME ?= /lib/faketime
+ 
+-CFLAGS += -std=gnu99 -Wall -Wextra -Werror -DFAKE_STAT -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"'
++CFLAGS += -std=gnu99 -Wall -Wextra -Werror -Wno-nonnull-compare -DFAKE_STAT -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"'
+ LIB_LDFLAGS += -shared
+ LDFLAGS += -Wl,--version-script=libfaketime.map -lpthread
+ LDADD += -ldl -lm -lrt
+-- 
+2.9.3
+
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/1 package/faketime: fix build with gcc >= 6

Quoted 22 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

Upstream added -Wno-nonnull-compare to disable this error [1].
Fixes:
libfaketime.c:513:7: error?: nonnull argument ??buf?? compared to NULL [-Werror=nonnull-compare]

    if (buf != NULL)
       ^

[1] https://github.com/wolfcw/libfaketime/commit/47e958b753fc15098a2b7d0e9ef26b83ee255874

---
 ...isable-the-non-null-compare-warning-error.patch | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 package/faketime/0001-Disable-the-non-null-compare-warning-error.patch
package/faketime/0001-Disable-the-non-null-compare-warning-error.patch new file +1 -0
new file mode 100644
index 0000000..859592e
@@ -0,0 +1,31 @@
+From e85a157b51b1276c91c736d8624d9f3e876e9189 Mon Sep 17 00:00:00 2001

package/faketime/0001-Disable-the-non-null-compare-warning-error.patch line 11

Quoted 10 lines
package/faketime/0001-Disable-the-non-null-compare-warning-error.patch new file +10 -0
+From: Andreas Rammhold <[email protected]>
+Date: Tue, 20 Dec 2016 19:25:32 +0100
+Subject: [PATCH] Disable the non-null compare warning/error.
+
+We rely on the provided local library definitions for the hooked
+functions which in some cases (GCC >6) carry a non-null-attribute flag
+which causes compile errors on `!= NULL` checks.
+
+[Romain: rebase on 0.9.6]
+Signed-off-by: Romain Naour <[email protected]>

It is nice if you use the -x option to git cherry-pick so it adds a comment about the original git commit id. I've now manually added it.

Quoted 4 lines
package/faketime/0001-Disable-the-non-null-compare-warning-error.patch new file +4 -0
+---
+ src/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/faketime/0001-Disable-the-non-null-compare-warning-error.patch line 25

Quoted 10 lines
package/faketime/0001-Disable-the-non-null-compare-warning-error.patch new file +10 -0
+diff --git a/src/Makefile b/src/Makefile
+index 51634b0..bbbd476 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -67,7 +67,7 @@ INSTALL ?= install
+ PREFIX ?= /usr/local
+ LIBDIRNAME ?= /lib/faketime
+ 
+-CFLAGS += -std=gnu99 -Wall -Wextra -Werror -DFAKE_STAT -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"'
++CFLAGS += -std=gnu99 -Wall -Wextra -Werror -Wno-nonnull-compare -DFAKE_STAT -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"'

The -Wall -Werror flags are not so nice, but oh well.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 package/faketime: fix build with gcc >= 6

Hi Peter,

Le 15/05/2017 ? 20:24, Peter Korsgaard a ?crit :

Quoted 27 lines
Quoted 27 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

Upstream added -Wno-nonnull-compare to disable this error [1].
Fixes:
libfaketime.c:513:7: error : nonnull argument ? buf ? compared to NULL [-Werror=nonnull-compare]

    if (buf != NULL)
       ^

[1] https://github.com/wolfcw/libfaketime/commit/47e958b753fc15098a2b7d0e9ef26b83ee255874

---
 ...isable-the-non-null-compare-warning-error.patch | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 package/faketime/0001-Disable-the-non-null-compare-warning-error.patch
package/faketime/0001-Disable-the-non-null-compare-warning-error.patch new file +6 -0
new file mode 100644
index 0000000..859592e
@@ -0,0 +1,31 @@
+From e85a157b51b1276c91c736d8624d9f3e876e9189 Mon Sep 17 00:00:00 2001
+From: Andreas Rammhold <[email protected]>
+Date: Tue, 20 Dec 2016 19:25:32 +0100
+Subject: [PATCH] Disable the non-null compare warning/error.
+
+We rely on the provided local library definitions for the hooked
Quoted 8 lines

package/faketime/0001-Disable-the-non-null-compare-warning-error.patch line 11

Quoted 5 lines
package/faketime/0001-Disable-the-non-null-compare-warning-error.patch new file +5 -0
+functions which in some cases (GCC >6) carry a non-null-attribute flag
+which causes compile errors on `!= NULL` checks.
+
+[Romain: rebase on 0.9.6]
+Signed-off-by: Romain Naour <[email protected]>

It is nice if you use the -x option to git cherry-pick so it adds a comment about the original git commit id. I've now manually added it.

Well, sometime I just use git format-patch -1 HASH when the patch apply cleanly without creating a new branch and cherry-picking. In that case there is no -x option...
Ok, I'll take care to keep the upstream hash :)

Quoted 18 lines
Quoted 6 lines
package/faketime/0001-Disable-the-non-null-compare-warning-error.patch new file +4 -0
+---
+ src/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+

package/faketime/0001-Disable-the-non-null-compare-warning-error.patch line 25

Quoted 10 lines
package/faketime/0001-Disable-the-non-null-compare-warning-error.patch new file +10 -0
+diff --git a/src/Makefile b/src/Makefile
+index 51634b0..bbbd476 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -67,7 +67,7 @@ INSTALL ?= install
+ PREFIX ?= /usr/local
+ LIBDIRNAME ?= /lib/faketime
+ 
+-CFLAGS += -std=gnu99 -Wall -Wextra -Werror -DFAKE_STAT -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"'
++CFLAGS += -std=gnu99 -Wall -Wextra -Werror -Wno-nonnull-compare -DFAKE_STAT -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"'

The -Wall -Werror flags are not so nice, but oh well.

ha yes... do you want I send a new patch removing Werror instead ?

Best regards,
Romain

Quoted 3 lines

Committed, thanks.

#3 lore raw

PATCH 1/1 package/faketime: fix build with gcc >= 6

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

Hi,

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

+[Romain: rebase on 0.9.6]
+Signed-off-by: Romain Naour <[email protected]>

It is nice if you use the -x option to git cherry-pick so it adds a comment about the original git commit id. I've now manually added it.

Well, sometime I just use git format-patch -1 HASH when the patch apply cleanly without creating a new branch and cherry-picking. In that case there is no -x option...

No, but in that case you are not rebasing, so the git hash listed in the commit is the correct one. The -x option is only when you rebase / cherry-pick for traceability.

Quoted 21 lines
Quoted 12 lines
Quoted 12 lines
+---
+ src/Makefile | 2 +-

+ 1 file changed, 1 insertion(+), 1 deletion(-)

package/faketime/0001-Disable-the-non-null-compare-warning-error.patch new file +9 -0
+
+diff --git a/src/Makefile b/src/Makefile
+index 51634b0..bbbd476 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -67,7 +67,7 @@ INSTALL ?= install
+ PREFIX ?= /usr/local
+ LIBDIRNAME ?= /lib/faketime
+ 
Quoted 8 lines

Review

Quoted 6 lines

+-CFLAGS += -std=gnu99 -Wall -Wextra -Werror -DFAKE_STAT

(quoted diff) +1 -4
-DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC
-DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"'
++CFLAGS += -std=gnu99 -Wall -Wextra -Werror -Wno-nonnull-compare
-DFAKE_STAT -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS
-fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"'

The -Wall -Werror flags are not so nice, but oh well.

Quoted 1 line

ha yes... do you want I send a new patch removing Werror instead ?

So far we don't seem to have any build failures from it (besides this one), so it isn't strictly needed - Just a potential problem.

I would leave it as is for now, unless if we can convince upstream to accept such a patch.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 package/faketime: fix build with gcc >= 6

In reply to Romain Naour
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

Upstream added -Wno-nonnull-compare to disable this error [1].
Fixes:
libfaketime.c:513:7: error?: nonnull argument ??buf?? compared to NULL [-Werror=nonnull-compare]

    if (buf != NULL)
       ^

[1] https://github.com/wolfcw/libfaketime/commit/47e958b753fc15098a2b7d0e9ef26b83ee255874

Committed to 2017.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard