When compiling native MirOS BSD binaries with SUNpro 12 (don't look like a

car only slower, yes this is possible, and the resulting binary passes the
testsuite just fine), the definition of __RCSID() in <sys/cdefs.h> expands
to something with __attribute__((used)), which triggers a warning, because
__attribute__ in general is supported but the used attribute isn't. Thusly
always use our own strings and get rid of the MULTI_RCSID test (introduced
because __RCSID() on Darwin is inferiour).

Maybe we should fix <sys/cdefs.h> too? #ifdef __SUNPRO_C helps here.
This commit is contained in:
tg 2007-06-04 21:27:53 +00:00
parent 0926a6d182
commit 6e1bfd6e4b
3 changed files with 35 additions and 50 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $MirOS: src/bin/mksh/Build.sh,v 1.194 2007/06/04 21:15:27 tg Exp $
# $MirOS: src/bin/mksh/Build.sh,v 1.195 2007/06/04 21:27:53 tg Exp $
#-
# Environment used: CC CFLAGS CPP CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM
@ -678,15 +678,6 @@ EOF
test 1 = $HAVE_PERSISTENT_HISTORY || \
check_categories=$check_categories,no-histfile
# Should be the _last_ one
ac_test multi_idstring '' 'if we can use __RCSID(x) multiple times' <<-'EOF'
#define HAVE_MULTI_IDSTRING 1
#include "sh.h"
__RCSID("one");
__RCSID("two");
int main(void) { return (0); }
EOF
#
# Compiler: Praeprocessor (only if needed)
#

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/Makefile,v 1.39 2007/05/24 09:06:31 tg Exp $
# $MirOS: src/bin/mksh/Makefile,v 1.40 2007/06/04 21:27:53 tg Exp $
#-
# use CPPFLAGS=-DDEBUG __CRAZY=Yes to check for certain more stuff
@ -23,8 +23,7 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 \
-DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 \
-DHAVE_STRLCPY=1 -DHAVE_ARC4RANDOM_DECL=1 \
-DHAVE_ARC4RANDOM_PUSH_DECL=1 -DHAVE_CONFSTR_DECL=1 \
-DHAVE_SYS_SIGLIST_DECL=1 -DHAVE_PERSISTENT_HISTORY=1 \
-DHAVE_MULTI_IDSTRING=1
-DHAVE_SYS_SIGLIST_DECL=1 -DHAVE_PERSISTENT_HISTORY=1
COPTS+= -std=gnu99 -Wall
.endif

69
sh.h
View File

@ -8,36 +8,13 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.137 2007/05/24 23:07:19 tg Exp $"
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.138 2007/06/04 21:27:53 tg Exp $"
#define MKSH_VERSION "R29 2007/05/24"
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/types.h>
#if defined(MKSH_INCLUDES_ONLY) || !HAVE_MULTI_IDSTRING
#undef __RCSID
#endif
#if !defined(__RCSID) || !defined(__SCCSID)
#undef __IDSTRING
#undef __IDSTRING_CONCAT
#undef __IDSTRING_EXPAND
#undef __RCSID
#undef __SCCSID
#if HAVE_ATTRIBUTE_USED
#define __attribute____used__ __attribute__((used))
#else
#define __attribute____used__ /* nothing */
#endif
#define __IDSTRING_CONCAT(l,p) __LINTED__ ## l ## _ ## p
#define __IDSTRING_EXPAND(l,p) __IDSTRING_CONCAT(l,p)
#define __IDSTRING(prefix, string) \
static const char __IDSTRING_EXPAND(__LINE__,prefix) [] \
__attribute____used__ = "@(""#)" #prefix ": " string
#define __RCSID(x) __IDSTRING(rcsid,x)
#define __SCCSID(x) __IDSTRING(sccsid,x)
#endif
#include <sys/time.h>
#include <sys/file.h>
#include <sys/ioctl.h>
@ -87,6 +64,37 @@
#include <values.h>
#endif
#if HAVE_ATTRIBUTE
#undef __attribute__
#else
#define __attribute__(x) /* nothing */
#endif
#undef __unused
#define __unused __attribute__((unused))
#if HAVE_ATTRIBUTE_BOUNDED
#define __bound_att__(x) __attribute__(x)
#else
#define __bound_att__(x) /* nothing */
#endif
#if HAVE_ATTRIBUTE_USED
#define __attribute____used__ __attribute__((used))
#else
#define __attribute____used__ /* nothing */
#endif
#undef __IDSTRING
#undef __IDSTRING_CONCAT
#undef __IDSTRING_EXPAND
#undef __RCSID
#undef __SCCSID
#define __IDSTRING_CONCAT(l,p) __LINTED__ ## l ## _ ## p
#define __IDSTRING_EXPAND(l,p) __IDSTRING_CONCAT(l,p)
#define __IDSTRING(prefix, string) \
static const char __IDSTRING_EXPAND(__LINE__,prefix) [] \
__attribute____used__ = "@(""#)" #prefix ": " string
#define __RCSID(x) __IDSTRING(rcsid,x)
#define __SCCSID(x) __IDSTRING(sccsid,x)
#ifndef MKSH_INCLUDES_ONLY
/* extra types */
@ -138,19 +146,6 @@ typedef int bool;
#define ksh_toupper(c) (((c) >= 'a') && ((c) <= 'z') ? (c) - 'a' + 'A' : (c))
#define ksh_isdash(s) (((s) != NULL) && ((s)[0] == '-') && ((s)[1] == '\0'))
#if HAVE_ATTRIBUTE
#undef __attribute__
#if HAVE_ATTRIBUTE_BOUNDED
#define __bound_att__ __attribute__
#else
#define __bound_att__(x) /* nothing */
#endif
#else
#define __attribute__(x) /* nothing */
#endif
#undef __unused
#define __unused __attribute__((unused))
/* this macro must not evaluate its arguments several times */
#define ksh_isspace(c) __extension__({ \
unsigned char ksh_isspace_c = (c); \