Module Name: src
Committed By: kamil
Date: Thu Jun 14 10:14:39 UTC 2018
Modified Files:
src/external/gpl2/grep/dist/lib: obstack.c
Log Message:
Make the alignof() usage more portable in grep(1)
Remove NetBSD specific check and replace it with GCC extension __alignof__
that is available since GCC 2.x.
Requested by <kre>
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/gpl2/grep/dist/lib/obstack.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl2/grep/dist/lib/obstack.c
diff -u src/external/gpl2/grep/dist/lib/obstack.c:1.2 src/external/gpl2/grep/dist/lib/obstack.c:1.3
--- src/external/gpl2/grep/dist/lib/obstack.c:1.2 Wed Jun 13 17:32:29 2018
+++ src/external/gpl2/grep/dist/lib/obstack.c Thu Jun 14 10:14:39 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: obstack.c,v 1.2 2018/06/13 17:32:29 kamil Exp $ */
+/* $NetBSD: obstack.c,v 1.3 2018/06/14 10:14:39 kamil Exp $ */
/* obstack.c - subroutines used implicitly by object stack macros
Copyright (C) 1988-1994,96,97,98,99 Free Software Foundation, Inc.
@@ -61,23 +61,7 @@
/* Determine default alignment. */
struct fooalign {char x; double d;};
-
-#if defined(__NetBSD__)
-#include <sys/param.h>
-#endif
-
-#ifndef __NetBSD_Prereq__
-#define __NetBSD_Prereq__(a,b,c) 0
-#endif
-
-#if __NetBSD_Prereq__(8,0,0)
-#include <stdalign.h>
-// Avoid Undefined Behavior
-#define DEFAULT_ALIGNMENT ((int)alignof(struct fooalign))
-#else
-#define DEFAULT_ALIGNMENT \
- ((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0))
-#endif
+#define DEFAULT_ALIGNMENT ((int)__alignof__(struct fooalign))
/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
But in fact it might be less smart and round addresses to as much as
DEFAULT_ROUNDING. So we prepare for it to do that. */