1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

Apply r379037 instead of trying to use C11's max_align_t

While here use my own comment within the file in order to:
- Avoid $FreeBSD$ keywords in patches (per Porter's Handbook)
- Improve rationale

Suggested by:	marino
This commit is contained in:
Jan Beich 2015-04-20 14:02:03 +00:00
parent 43d1f3cc8d
commit 8319f15154
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=384361
2 changed files with 39 additions and 24 deletions

View File

@ -0,0 +1,39 @@
C11 defines different max_align_t in stddef.h. It may either come from
compiler (GCC, Clang) or provided by the system (DragonFly, musl libc).
FreeBSD's Clang has neither due to bug 193594.
So, keep the old behavior by renaming the type here to avoid building
with -ansi (upstream nestegg) or -std=gnu89 (SUSE).
In file included from source/webmlib/halloc/halloc.c:19:0:
source/webmlib/halloc/align.h:42:25: error: conflicting types for 'max_align_t'
typedef union max_align max_align_t;
^
In file included from source/webmlib/halloc/halloc.h:18:0,
from source/webmlib/halloc/halloc.c:18:
/usr/local/lib/gcc5/**/include/stddef.h:429:3: note: previous declaration of 'max_align_t' was here
} max_align_t;
^
--- source/webmlib/halloc/align.h.orig 2015-04-09 22:13:36 UTC
+++ source/webmlib/halloc/align.h
@@ -39,7 +39,7 @@ union max_align
void (*q)(void);
};
-typedef union max_align max_align_t;
+typedef union max_align halloc_max_align_t;
#endif
--- source/webmlib/halloc/halloc.c.orig 2015-04-09 22:13:36 UTC
+++ source/webmlib/halloc/halloc.c
@@ -30,7 +30,7 @@ typedef struct hblock
#endif
hlist_item_t siblings; /* 2 pointers */
hlist_head_t children; /* 1 pointer */
- max_align_t data[1]; /* not allocated, see below */
+ halloc_max_align_t data[1]; /* not allocated, see below */
} hblock_t;

View File

@ -1,24 +0,0 @@
GCC 5.0 defaults to -std=gnu11 which exposes max_align_t in its stddef.h.
Clang also provides max_align_t but not on FreeBSD (see bug 193594).
In file included from source/webmlib/halloc/halloc.c:19:0:
source/webmlib/halloc/align.h:42:25: error: conflicting types for 'max_align_t'
typedef union max_align max_align_t;
^
In file included from source/webmlib/halloc/halloc.h:18:0,
from source/webmlib/halloc/halloc.c:18:
/usr/local/lib/gcc5/**/include/stddef.h:429:3: note: previous declaration of 'max_align_t' was here
} max_align_t;
^
--- source/webmlib/halloc/align.h.orig 2015-04-09 22:13:36 UTC
+++ source/webmlib/halloc/align.h
@@ -22,7 +22,7 @@
*/
typedef double max_align_t;
-#else
+#elif !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
/*
* a type with the most strict alignment requirements