From a0d43a99fd14b520af2a092372a770a8f7168535 Mon Sep 17 00:00:00 2001 From: tg Date: Tue, 24 Aug 2010 15:19:54 +0000 Subject: [PATCH] =?UTF-8?q?it=E2=80=99s=20ugly=20to=20write=20a=20./stdint?= =?UTF-8?q?.h=20file=20if=20we=20can=20instead=20define=20the=20types=20fr?= =?UTF-8?q?om=20sh.h;=20sync=20clog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Build.sh | 53 +++++++++++++++++++++-------------------------------- Makefile | 19 ++++++++++--------- sh.h | 19 ++++++++++++++++++- 3 files changed, 49 insertions(+), 42 deletions(-) diff --git a/Build.sh b/Build.sh index 7af48fd..0e45c1a 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.457 2010/08/15 00:43:55 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.458 2010/08/24 15:19:52 tg Exp $' #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Thorsten Glaser @@ -284,7 +284,7 @@ if test -d mksh || test -d mksh.exe; then exit 1 fi rmf a.exe* a.out* conftest.c *core lft mksh* no *.bc *.ll *.o \ - Rebuild.sh signames.inc stdint.h test.sh x vv.out + Rebuild.sh signames.inc test.sh x vv.out curdir=`pwd` srcdir=`dirname "$0"` check_categories= test -n "$dirname" || dirname=. @@ -1069,44 +1069,16 @@ ac_header sys/param.h ac_header sys/mkdev.h sys/types.h ac_header sys/mman.h sys/types.h ac_header sys/sysmacros.h +ac_header grp.h sys/types.h ac_header libgen.h ac_header libutil.h sys/types.h ac_header paths.h ac_header stdbool.h +ac_header stdint.h stdarg.h ac_header strings.h sys/types.h -ac_header grp.h sys/types.h ac_header ulimit.h sys/types.h ac_header values.h -ac_header '!' stdint.h stdarg.h -ac_testn can_inttypes '!' stdint_h 1 "for standard 32-bit integer types" <<-'EOF' - #include - int main(int ac, char **av) { return ((uint32_t)*av + (int32_t)ac); } -EOF -ac_testn can_ucbints '!' can_inttypes 1 "for UCB 32-bit integer types" <<-'EOF' - #include - int main(int ac, char **av) { return ((u_int32_t)*av + (int32_t)ac); } -EOF -ac_testn can_int8type '!' stdint_h 1 "for standard 8-bit integer type" <<-'EOF' - #include - int main(int ac, char **av) { return ((uint8_t)av[ac]); } -EOF -ac_testn can_ucbint8 '!' can_int8type 1 "for UCB 8-bit integer type" <<-'EOF' - #include - int main(int ac, char **av) { return ((u_int8_t)av[ac]); } -EOF -case $HAVE_CAN_INTTYPES$HAVE_CAN_UCBINTS in -01) echo 'typedef u_int32_t uint32_t;' >>stdint.h ;; -00) echo 'typedef signed int int32_t;' >>stdint.h - echo 'typedef unsigned int uint32_t;' >>stdint.h ;; -esac -case $HAVE_CAN_INT8TYPE$HAVE_CAN_UCBINT8 in -01) echo 'typedef u_int8_t uint8_t;' >>stdint.h ;; -00) echo 'typedef unsigned char uint8_t;' >>stdint.h ;; -esac -test -f stdint.h && HAVE_STDINT_H=1 -ac_cppflags STDINT_H - # # Environment: definitions # @@ -1130,6 +1102,23 @@ rmf lft* # end of large file support test # # Environment: types # +ac_test can_inttypes '!' stdint_h 1 "for standard 32-bit integer types" <<-'EOF' + #include + int main(int ac, char **av) { return ((uint32_t)*av + (int32_t)ac); } +EOF +ac_test can_ucbints '!' can_inttypes 1 "for UCB 32-bit integer types" <<-'EOF' + #include + int main(int ac, char **av) { return ((u_int32_t)*av + (int32_t)ac); } +EOF +ac_test can_int8type '!' stdint_h 1 "for standard 8-bit integer type" <<-'EOF' + #include + int main(int ac, char **av) { return ((uint8_t)av[ac]); } +EOF +ac_test can_ucbint8 '!' can_int8type 1 "for UCB 8-bit integer type" <<-'EOF' + #include + int main(int ac, char **av) { return ((u_int8_t)av[ac]); } +EOF + ac_test rlim_t <<-'EOF' #include #include diff --git a/Makefile b/Makefile index d16cbf1..5e5eb0d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -# $MirOS: src/bin/mksh/Makefile,v 1.80 2010/07/04 17:41:39 tg Exp $ +# $MirOS: src/bin/mksh/Makefile,v 1.81 2010/08/24 15:19:53 tg Exp $ #- -# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Thorsten Glaser # # Provided that these terms and disclaimer and all copyright notices @@ -31,13 +31,14 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 \ -DHAVE_ATTRIBUTE_NONNULL=1 -DHAVE_ATTRIBUTE_NORETURN=1 \ -DHAVE_ATTRIBUTE_UNUSED=1 -DHAVE_ATTRIBUTE_USED=1 \ -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_MKDEV_H=0 -DHAVE_SYS_MMAN_H=1 \ - -DHAVE_SYS_SYSMACROS_H=0 -DHAVE_LIBGEN_H=1 -DHAVE_LIBUTIL_H=0 \ - -DHAVE_PATHS_H=1 -DHAVE_STDBOOL_H=1 -DHAVE_STRINGS_H=1 \ - -DHAVE_GRP_H=1 -DHAVE_ULIMIT_H=0 -DHAVE_VALUES_H=0 \ - -DHAVE_STDINT_H=1 -DHAVE_RLIM_T=1 -DHAVE_SIG_T=1 \ - -DHAVE_SYS_SIGNAME=1 -DHAVE_SYS_SIGLIST=1 -DHAVE_STRSIGNAL=0 \ - -DHAVE_GETRUSAGE=1 -DHAVE_KILLPG=1 -DHAVE_MKNOD=1 \ - -DHAVE_MKSTEMP=1 -DHAVE_NICE=1 -DHAVE_REVOKE=1 \ + -DHAVE_SYS_SYSMACROS_H=0 -DHAVE_GRP_H=1 -DHAVE_LIBGEN_H=1 \ + -DHAVE_LIBUTIL_H=0 -DHAVE_PATHS_H=1 -DHAVE_STDBOOL_H=1 \ + -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_ULIMIT_H=0 \ + -DHAVE_VALUES_H=0 -DHAVE_CAN_INTTYPES=1 -DHAVE_CAN_UCBINTS=1 \ + -DHAVE_CAN_INT8TYPE=1 -DHAVE_CAN_UCBINT8=1 -DHAVE_RLIM_T=1 \ + -DHAVE_SIG_T=1 -DHAVE_SYS_SIGNAME=1 -DHAVE_SYS_SIGLIST=1 \ + -DHAVE_STRSIGNAL=0 -DHAVE_GETRUSAGE=1 -DHAVE_KILLPG=1 \ + -DHAVE_MKNOD=1 -DHAVE_MKSTEMP=1 -DHAVE_NICE=1 -DHAVE_REVOKE=1 \ -DHAVE_SETLOCALE_CTYPE=0 -DHAVE_LANGINFO_CODESET=0 \ -DHAVE_SETMODE=1 -DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 \ -DHAVE_STRCASESTR=1 -DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 \ diff --git a/sh.h b/sh.h index 15f709b..11588c9 100644 --- a/sh.h +++ b/sh.h @@ -150,7 +150,7 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.404 2010/08/24 14:42:04 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.405 2010/08/24 15:19:54 tg Exp $"); #endif #define MKSH_VERSION "R39 2010/08/24" @@ -188,6 +188,23 @@ typedef int bool; #define true 1 #endif +#if !HAVE_CAN_INTTYPES +#if !HAVE_CAN_UCBINTS +typedef signed int int32_t; +typedef unsigned int uint32_t; +#else +typedef u_int32_t uint32_t; +#endif +#endif + +#if !HAVE_CAN_INT8TYPE +#if !HAVE_CAN_UCBINT8 +typedef unsigned char uint8_t; +#else +typedef u_int8_t uint8_t; +#endif +#endif + /* extra macros */ #ifndef timerclear