SHA256
1
0
forked from pool/popt

Accepting request 202544 from home:Andreas_Schwab:Factory

- popt-alignment-checks.patch: fix alignment checks

OBS-URL: https://build.opensuse.org/request/show/202544
OBS-URL: https://build.opensuse.org/package/show/Base:System/popt?expand=0&rev=44
This commit is contained in:
Cristian Rodríguez 2013-10-07 22:35:58 +00:00 committed by Git OBS Bridge
parent b6afadd83a
commit 82f8480513
3 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,74 @@
Index: popt-1.16/configure.ac
===================================================================
--- popt-1.16.orig/configure.ac
+++ popt-1.16/configure.ac
@@ -47,7 +47,7 @@ AC_SYS_LARGEFILE
AC_ISC_POSIX
-AC_CHECK_HEADERS(float.h fnmatch.h glob.h langinfo.h libintl.h mcheck.h unistd.h)
+AC_CHECK_HEADERS(float.h fnmatch.h glob.h langinfo.h libintl.h mcheck.h unistd.h stdalign.h)
# For some systems we know that we have ld_version scripts.
# Use it then as default.
Index: popt-1.16/popt.c
===================================================================
--- popt-1.16.orig/popt.c
+++ popt-1.16/popt.c
@@ -25,6 +25,15 @@ extern long long int strtoll(const char
#include "poptint.h"
+#ifdef HAVE_STDALIGN_H
+#include <stdalign.h>
+#define ALIGNOF(x) alignof(x)
+#elif defined __GNUC__
+#define ALIGNOF(x) __alignof__(x)
+#else
+#define ALIGNOF(x) sizeof(x)
+#endif
+
#ifdef MYDEBUG
/*@unchecked@*/
int _popt_debug = 0;
@@ -977,12 +986,8 @@ static unsigned int seed = 0;
int poptSaveLongLong(long long * arg, unsigned int argInfo, long long aLongLong)
{
- if (arg == NULL
-#ifdef NOTYET
/* XXX Check alignment, may fail on funky platforms. */
- || (((unsigned long long)arg) & (sizeof(*arg)-1))
-#endif
- )
+ if (arg == NULL || (((unsigned long)arg) & (ALIGNOF(*arg)-1)))
return POPT_ERROR_NULLARG;
if (aLongLong != 0 && LF_ISSET(RANDOM)) {
@@ -1023,7 +1028,7 @@ int poptSaveLongLong(long long * arg, un
int poptSaveLong(long * arg, unsigned int argInfo, long aLong)
{
/* XXX Check alignment, may fail on funky platforms. */
- if (arg == NULL || (((unsigned long)arg) & (sizeof(*arg)-1)))
+ if (arg == NULL || (((unsigned long)arg) & (ALIGNOF(*arg)-1)))
return POPT_ERROR_NULLARG;
if (aLong != 0 && LF_ISSET(RANDOM)) {
@@ -1056,7 +1061,7 @@ int poptSaveLong(long * arg, unsigned in
int poptSaveInt(/*@null@*/ int * arg, unsigned int argInfo, long aLong)
{
/* XXX Check alignment, may fail on funky platforms. */
- if (arg == NULL || (((unsigned long)arg) & (sizeof(*arg)-1)))
+ if (arg == NULL || (((unsigned long)arg) & (ALIGNOF(*arg)-1)))
return POPT_ERROR_NULLARG;
if (aLong != 0 && LF_ISSET(RANDOM)) {
@@ -1089,7 +1094,7 @@ int poptSaveInt(/*@null@*/ int * arg, un
int poptSaveShort(/*@null@*/ short * arg, unsigned int argInfo, long aLong)
{
/* XXX Check alignment, may fail on funky platforms. */
- if (arg == NULL || (((unsigned long)arg) & (sizeof(*arg)-1)))
+ if (arg == NULL || (((unsigned long)arg) & (ALIGNOF(*arg)-1)))
return POPT_ERROR_NULLARG;
if (aLong != 0 && LF_ISSET(RANDOM)) {

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Oct 7 14:25:32 UTC 2013 - schwab@suse.de
- popt-alignment-checks.patch: fix alignment checks
-------------------------------------------------------------------
Sun Jul 7 16:34:40 UTC 2013 - jengelh@inai.de

View File

@ -32,6 +32,7 @@ BuildRequires: libtool
BuildRequires: pkgconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Patch0: popt-libc-updates.patch
Patch1: popt-alignment-checks.patch
%description
Popt is a C library for parsing command line parameters. Popt was
@ -71,6 +72,7 @@ API documentation of the popt library, too.
%prep
%setup -q
%patch0
%patch1 -p1
%build
autoreconf -fiv