From 4d23a65454a9ae7d175c5647c321c56a4e0ce07d Mon Sep 17 00:00:00 2001 From: tg Date: Tue, 29 Aug 2017 13:38:31 +0000 Subject: [PATCH] monkey-patch offsetof for a klibc/dietlibc warning; bump to R56b (bugfixes) --- Build.sh | 4 ++-- Makefile | 4 ++-- check.t | 6 +++--- sh.h | 13 ++++++++++--- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Build.sh b/Build.sh index eaf27af..78fe347 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.726 2017/08/07 20:40:56 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.727 2017/08/29 13:38:28 tg Exp $' #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013, 2014, 2015, 2016, 2017 @@ -2409,7 +2409,7 @@ addsrcs '!' HAVE_STRLCPY strlcpy.c addsrcs USE_PRINTF_BUILTIN printf.c test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose" -add_cppflags -DMKSH_BUILD_R=561 +add_cppflags -DMKSH_BUILD_R=562 $e $bi$me: Finished configuration testing, now producing output.$ao diff --git a/Makefile b/Makefile index 7a014bf..ab625f2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/Makefile,v 1.161 2017/08/07 21:39:25 tg Exp $ +# $MirOS: src/bin/mksh/Makefile,v 1.162 2017/08/29 13:38:29 tg Exp $ #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013, 2014, 2015, 2016, 2017 @@ -58,7 +58,7 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 -DMKSH_DISABLE_DEPRECATED \ -DHAVE_STRERROR=0 -DHAVE_STRSIGNAL=0 -DHAVE_STRLCPY=1 \ -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \ -DHAVE_SYS_ERRLIST_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \ - -DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=561 + -DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=562 CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U} CPPFLAGS+= -I. COPTS+= -std=c89 -Wall diff --git a/check.t b/check.t index 21938e9..4473c08 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.796 2017/08/08 21:11:18 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.797 2017/08/29 13:38:29 tg Exp $ # -*- mode: sh -*- #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -30,7 +30,7 @@ # (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date expected-stdout: - @(#)MIRBSD KSH R56 2017/08/08 + @(#)MIRBSD KSH R56 2017/08/29 description: Check base version of full shell stdin: @@ -39,7 +39,7 @@ name: KSH_VERSION category: !shell:legacy-yes --- expected-stdout: - @(#)LEGACY KSH R56 2017/08/08 + @(#)LEGACY KSH R56 2017/08/29 description: Check base version of legacy shell stdin: diff --git a/sh.h b/sh.h index 1f1adb4..88883cb 100644 --- a/sh.h +++ b/sh.h @@ -112,6 +112,13 @@ #include #endif +/* monkey-patch known-bad offsetof versions to quell a warning */ +#if (defined(__KLIBC__) || defined(__dietlibc__)) && \ + ((defined(__GNUC__) && (__GNUC__ > 3)) || defined(__NWCC__)) +#undef offsetof +#define offsetof(s, e) __builtin_offsetof(s, e) +#endif + #undef __attribute__ #if HAVE_ATTRIBUTE_BOUNDED #define MKSH_A_BOUNDED(x,y,z) __attribute__((__bounded__(x, y, z))) @@ -175,9 +182,9 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.840 2017/08/08 21:11:20 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.841 2017/08/29 13:38:31 tg Exp $"); #endif -#define MKSH_VERSION "R56 2017/08/08" +#define MKSH_VERSION "R56 2017/08/29" /* arithmetic types: C implementation */ #if !HAVE_CAN_INTTYPES @@ -636,7 +643,7 @@ char *ucstrstr(char *, const char *); #endif #endif -#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 561) +#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 562) #error Must run Build.sh to compile this. extern void thiswillneverbedefinedIhope(void); int