Skip to content

Commit

Permalink
we seem to have forgotten we need __attribute__((__used__)) for idstring
Browse files Browse the repository at this point in the history
  • Loading branch information
mirabilos committed Aug 13, 2021
1 parent 23cdb9f commit 6adc4d1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
14 changes: 13 additions & 1 deletion Build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/sleep/Build.sh,v 1.2 2021/07/27 20:11:53 tg Exp $'
srcversion='$MirOS: src/bin/sleep/Build.sh,v 1.3 2021/08/13 22:29:26 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019,
Expand Down Expand Up @@ -1295,6 +1295,18 @@ ac_test attribute_unused '' 'for __attribute__((__unused__))' <<-'EOF'
__attribute__((__unused__))) { return (isatty(0)); }
#endif
EOF
ac_test attribute_used attribute_extension 0 'for __attribute__((__used__))' <<-'EOF'
#if defined(__TenDRA__) || (defined(__GNUC__) && (__GNUC__ < 2))
extern int thiswillneverbedefinedIhope(void);
/* force a failure: TenDRA and gcc 1.42 have false positive here */
int main(void) { return (thiswillneverbedefinedIhope()); }
#else
#include <unistd.h>
#undef __attribute__
static const char fnord[] __attribute__((__used__)) = "42";
int main(void) { return (isatty(0)); }
#endif
EOF

# End of tests run with -Werror
NOWARN=$save_NOWARN
Expand Down
7 changes: 6 additions & 1 deletion sleep.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
#else
#define MKSH_A_UNUSED /* nothing */
#endif
#if HAVE_ATTRIBUTE_USED
#define MKSH_A_USED __attribute__((__used__))
#else
#define MKSH_A_USED /* nothing */
#endif

#if defined(MirBSD) && (MirBSD >= 0x09A1) && \
defined(__ELF__) && defined(__GNUC__) && \
Expand Down Expand Up @@ -116,7 +121,7 @@
#endif

#ifdef EXTERN
__RCSID("$MirOS: src/bin/sleep/sleep.h,v 1.3 2021/07/27 20:11:54 tg Exp $");
__RCSID("$MirOS: src/bin/sleep/sleep.h,v 1.4 2021/08/13 22:29:27 tg Exp $");
#endif

#define ord(c) ((unsigned int)(unsigned char)(c))
Expand Down

0 comments on commit 6adc4d1

Please sign in to comment.