summaryrefslogtreecommitdiff
blob: f5de3e2746ce87a427a546655f006baa89d83cb8 (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
https://bugs.gentoo.org/919095
https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/638
https://gitlab.gnome.org/GNOME/tracker/-/commit/f7393d61803815b19a1f210b197cce423ae3cc01

From f7393d61803815b19a1f210b197cce423ae3cc01 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Sun, 3 Dec 2023 12:10:27 +0000
Subject: [PATCH] build: Fix "4-digit year modifier" test

Upcoming `gcc-14` enabled a few warnings into errors, like
`-Wincompatible-pointer-types`. This caused `tracker` configure to
fail as:

    $ ../meson
    ...
    Checking if "strftime 4-digit year modifier" runs: DID NOT COMPILE

    ../meson.build:235:2: ERROR: Problem encountered: Libc implementation has broken 4-digit years implementation.

This happens because char buffer had an unusual type:

    testfile.c: In function 'main':
    testfile.c:16:17: error: passing argument 1 of 'strftime' from incompatible pointer type
    [-Wincompatible-pointer-types]
       16 |       strftime (&buf, sizeof buf, modifiers[i], &tm);
          |                 ^~~~
          |                 |
          |                 char * (*)[100]
--- a/meson.build
+++ b/meson.build
@@ -215,15 +215,15 @@ result = cc.run('''
   int main (int argc, char *argv[]) {
     char *modifiers[] = { "%Y", "%C%y", "%4Y", "%2C%y", NULL };
     time_t timestamp = -58979923200; /* 0101-01-01T01:01:01Z */
-    char *buf[100];
+    char buf[100];
     struct tm tm;
     int i;
     gmtime_r (&timestamp, &tm);
     for (i = 0; modifiers[i]; i++) {
-      strftime (&buf, sizeof buf, modifiers[i], &tm);
-      if (strcmp (&buf, "0101") == 0) {
+      strftime (buf, sizeof buf, modifiers[i], &tm);
+      if (strcmp (buf, "0101") == 0) {
         printf ("%s", modifiers[i]);
-	return 0;
+        return 0;
       }
     }
     return -1;
-- 
GitLab