linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* e2fsprogs 1.46.2 needs #include <time.h> in probe.c
@ 2021-04-11 12:57 Ryan Schmidt
  2021-04-11 23:58 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Ryan Schmidt @ 2021-04-11 12:57 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]

Hi,

I am the maintainer of e2fsprogs in MacPorts. The developer of e2fsprogs has asked me to report patches for his program to this mailing list.

e2fsprogs 1.46.2 does not build on macOS when implicit declaration of functions is considered an error. This condition can be achieved either by adding -Werror=implicit-function-declaration to CFLAGS when configuring or by compiling with the version of clang included with Xcode 12 or later on macOS in which that behavior is the default.

The error messages are:


probe.c:285:16: error: implicit declaration of function 'time' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        time_t          now = time(0);
                              ^
probe.c:1677:9: error: implicit declaration of function 'difftime' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        diff = difftime(now, dev->bid_time);
               ^
2 errors generated.


The fix is to #include <time.h> in probe.c per the attached patch.

This problem and the fix were reported to MacPorts against e2fsprogs 1.45.6 here: https://github.com/macports/macports-ports/pull/9137

Please Cc me on replies if you need further information.


[-- Attachment #2: patch-probe.c.diff --]
[-- Type: application/octet-stream, Size: 282 bytes --]

--- lib/blkid/probe.c	2020-11-15 14:19:10.000000000 -0500
+++ lib/blkid/probe.c.fixed	2020-11-15 14:21:25.000000000 -0500
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <time.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <ctype.h>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-11 23:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-11 12:57 e2fsprogs 1.46.2 needs #include <time.h> in probe.c Ryan Schmidt
2021-04-11 23:58 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).