- add platform.h.

- use shorter boilerplate while at it.
This commit is contained in:
Bernhard Reutner-Fischer 2006-01-22 22:55:11 +00:00
parent 2edf52643d
commit 86f5c9906b
30 changed files with 182 additions and 264 deletions

View File

@ -381,7 +381,7 @@ docs/busybox.net/BusyBox.html: docs/busybox.pod
scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
DEP_INCLUDES := include/config.h include/bb_config.h
DEP_INCLUDES := include/config.h include/bb_config.h include/_usage.h
ifeq ($(strip $(CONFIG_BBCONFIG)),y)
DEP_INCLUDES += include/bbconfigopts.h
@ -411,13 +411,22 @@ include/bb_config.h: include/config.h
< $< >> $@
@echo "#endif" >> $@
# Create macros for usage.h, e.g.:
#if ENABLE_HAVE_DOT_CONFIG
#define USAGE_HAVE_DOT_CONFIG(a) a
#else
#define USAGE_HAVE_DOT_CONFIG(a)
#endif
include/_usage.h: .config
awk '/CONFIG|BB_APPLET/{gsub("#[[:space:]]*|=y|.*CONFIG_|.*BB_APPLET_","");if(!/=/){print("#if ENABLE_"$$1"\n#define USAGE_"$$1"(a) a\n#else\n#define USAGE_"$$1"(a)\n#endif");}}' $(<) > $(@)
clean:
- $(MAKE) -C scripts/config $@
- $(RM_F) docs/busybox.dvi docs/busybox.ps \
docs/busybox.pod docs/busybox.net/busybox.html \
docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
docs/busybox.net/BusyBox.html busybox.links include/_usage.h \
$(DO_INSTALL_LIBS) $(LIBBUSYBOX_SONAME) \
.config.old busybox
- rm -rf _install testsuite/links

View File

@ -11,7 +11,7 @@
#define setlocale(x,y)
#endif
const char *bb_applet_name __attribute__((externally_visible));
const char *bb_applet_name ATTRIBUTE_EXTERNALLY_VISIBLE;
#ifdef CONFIG_FEATURE_INSTALLER
/*

View File

@ -1,6 +1,6 @@
#include <stdio.h>
#include "unarchive.h"
extern void header_skip(const file_header_t *file_header __attribute__((unused)))
extern void header_skip(const file_header_t *file_header ATTRIBUTE_UNUSED)
{
}

View File

@ -7,20 +7,7 @@
* Loosely based on original busybox unzip applet by Laurence Anderson.
* All options and features should work in this version.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
/* For reference see
@ -79,12 +66,12 @@ typedef union {
unsigned short method; /* 4-5 */
unsigned short modtime; /* 6-7 */
unsigned short moddate; /* 8-9 */
unsigned int crc32 __attribute__ ((packed)); /* 10-13 */
unsigned int cmpsize __attribute__ ((packed)); /* 14-17 */
unsigned int ucmpsize __attribute__ ((packed)); /* 18-21 */
unsigned int crc32 ATTRIBUTE_PACKED; /* 10-13 */
unsigned int cmpsize ATTRIBUTE_PACKED; /* 14-17 */
unsigned int ucmpsize ATTRIBUTE_PACKED; /* 18-21 */
unsigned short filename_len; /* 22-23 */
unsigned short extra_len; /* 24-25 */
} formated __attribute__ ((packed));
} formated ATTRIBUTE_PACKED;
} zip_header_t;
static void unzip_skip(int fd, off_t skip)

View File

@ -2,15 +2,8 @@
/* stty -- change and print terminal line settings
Copyright (C) 1990-1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
/* Usage: stty [-ag] [-F device] [setting...]
Options:
@ -428,7 +421,7 @@ static void set_window_size(int rows, int cols, int fd);
static const char *device_name;
static __attribute__ ((noreturn)) void perror_on_device(const char *fmt)
static ATTRIBUTE_NORETURN void perror_on_device(const char *fmt)
{
bb_perror_msg_and_die(fmt, device_name);
}

View File

@ -566,7 +566,7 @@ MOUNTS_COUNT_ERROR:
}
#ifdef CONFIG_FINDFS
static attribute_noreturn void do_findfs(int argc, char **argv)
static ATTRIBUTE_NORETURN void do_findfs(int argc, char **argv)
{
if ((argc != 2) ||
(strncmp(argv[1], "LABEL=", 6) && strncmp(argv[1], "UUID=", 5)))

View File

@ -54,7 +54,7 @@ typedef unsigned char uuid_t[16];
/* Allow UUID constants to be defined */
#ifdef __GNUC__
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
static const uuid_t name ATTRIBUTE_UNUSED = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
#else
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}

View File

@ -4,20 +4,7 @@
*
* Copyright (C) 2002 by Dmitry Zakharov <dmit@crp.bank.gov.ua>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <stdio.h>
@ -445,7 +432,7 @@ static void chain_group(void);
static var *evaluate(node *, var *);
static rstream *next_input_file(void);
static int fmt_num(char *, int, const char *, double, int);
static int awk_exit(int) attribute_noreturn;
static int awk_exit(int) ATTRIBUTE_NORETURN;
/* ---- error handling ---- */
@ -462,7 +449,7 @@ static const char EMSG_UNDEF_FUNC[] = "Call to undefined function";
static const char EMSG_NO_MATH[] = "Math support is not compiled in";
#endif
static void syntax_error(const char * const message) attribute_noreturn;
static void syntax_error(const char * const message) ATTRIBUTE_NORETURN;
static void syntax_error(const char * const message)
{
bb_error_msg_and_die("%s:%i: %s", programname, lineno, message);

View File

@ -2,24 +2,7 @@
/*
* Busybox main internal header file
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Permission has been granted to redistribute this code under the GPL.
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#ifndef _BB_INTERNAL_H_
#define _BB_INTERNAL_H_ 1
@ -66,8 +49,8 @@ enum SUIDRoot {
struct BB_applet {
const char *name;
int (*main) (int argc, char **argv);
enum Location location:4;
enum SUIDRoot need_suid:4;
__extension__ enum Location location:4;
__extension__ enum SUIDRoot need_suid:4;
};
/* From busybox.c */

View File

@ -2,27 +2,14 @@
/*
* Busybox main internal header file
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*
* Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Permission has been granted to redistribute this code under the GPL.
*
*/
#ifndef __LIBCONFIG_H__
#define __LIBCONFIG_H__ 1
#ifndef __LIBBUSYBOX_H__
#define __LIBBUSYBOX_H__ 1
#include <stdio.h>
#include <stdlib.h>
@ -36,6 +23,7 @@
#include <features.h>
#include "platform.h"
#include "bb_config.h"
#ifdef CONFIG_SELINUX
#include <selinux/selinux.h>
@ -50,21 +38,6 @@
# include "sha1.h"
#endif
/* Convenience macros to test the version of gcc. */
#if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#else
# define __GNUC_PREREQ(maj, min) 0
#endif
/* __restrict is known in EGCS 1.2 and above. */
#if !__GNUC_PREREQ (2,92)
# define __restrict /* Ignore */
#endif
#define attribute_noreturn __attribute__ ((__noreturn__))
/* Some useful definitions */
#define FALSE ((int) 0)
#define TRUE ((int) 1)
@ -86,7 +59,7 @@
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
extern void bb_show_usage(void) __attribute__ ((noreturn, externally_visible));
extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
@ -95,7 +68,7 @@ extern void bb_vherror_msg(const char *s, va_list p);
extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
extern void bb_perror_nomsg_and_die(void) __attribute__ ((noreturn));
extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN;
extern void bb_perror_nomsg(void);
/* These two are used internally -- you shouldn't need to use them */
@ -147,7 +120,7 @@ extern FILE *bb_wfopen_input(const char *filename);
extern FILE *bb_xfopen(const char *path, const char *mode);
extern int bb_fclose_nonstdin(FILE *f);
extern void bb_fflush_stdout_and_exit(int retval) __attribute__ ((noreturn));
extern void bb_fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN;
#define BB_GETOPT_ERROR 0x80000000UL
extern const char *bb_opt_complementally;
@ -498,4 +471,4 @@ extern int hash_fd(int fd, const size_t size, const uint8_t hash_algo, uint8_t *
#include <dmalloc.h>
#endif
#endif /* __LIBCONFIG_H__ */
#endif /* __LIBBUSYBOX_H__ */

82
include/platform.h Normal file
View File

@ -0,0 +1,82 @@
/*
Copyright 2006, Bernhard Fischer
Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#ifndef __PLATFORM_H
#define __PLATFORM_H 1
/* Convenience macros to test the version of gcc. */
#undef __GNUC_PREREQ
#if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#else
# define __GNUC_PREREQ(maj, min) 0
#endif
/* __restrict is known in EGCS 1.2 and above. */
#if !__GNUC_PREREQ (2,92)
# ifndef __restrict
# define __restrict /* Ignore */
# endif
#endif
/* Define macros for some gcc attributes. This permits us to use the
macros freely, and know that they will come into play for the
version of gcc in which they are supported. */
#if !__GNUC_PREREQ (2,7)
# ifndef __attribute__
# define __attribute__(x)
# endif
#endif
#if 0
/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
#ifndef ATTRIBUTE_MALLOC
# if __GNUC_PREREQ (2,96)
# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
# else
# define ATTRIBUTE_MALLOC
# endif /* GNUC >= 2.96 */
#endif /* ATTRIBUTE_MALLOC */
#endif
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif /* ATTRIBUTE_UNUSED */
#ifndef ATTRIBUTE_NORETURN
#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#endif /* ATTRIBUTE_NORETURN */
#ifndef ATTRIBUTE_PACKED
#define ATTRIBUTE_PACKED __attribute__ ((__packed__))
#endif /* ATTRIBUTE_NORETURN */
/* -fwhole-program makes all symbols local. The attribute externally_visible
forces a symbol global. */
#ifndef ATTRIBUTE_EXTERNALLY_VISIBLE
# if __GNUC_PREREQ (4,1)
# define ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((__externally_visible__))
# else
# define ATTRIBUTE_EXTERNALLY_VISIBLE
# endif /* GNUC >= 4.1 */
#endif /* ATTRIBUTE_EXTERNALLY_VISIBLE */
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
gcc 2.8. */
#if !__GNUC_PREREQ (2,8)
# ifndef __extension__
# define __extension__
# endif
#endif
/* include USAGE_APPLET_x helper macros for usage.h. */
/*
#include "_usage.h"
*/
#endif /* platform.h */

View File

@ -5,20 +5,7 @@
* Copyright (C) 1999 by Lineo, inc. and John Beppu
* Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#ifndef _GNU_SOURCE
@ -122,7 +109,7 @@ static void addgroup_wrapper(const char *login, gid_t gid)
free(cmd);
}
static void passwd_wrapper(const char *login) __attribute__ ((noreturn));
static void passwd_wrapper(const char *login) ATTRIBUTE_NORETURN;
static void passwd_wrapper(const char *login)
{

View File

@ -225,7 +225,7 @@ static void termio_final(struct options *op, struct termio *tp,
struct chardata *cp);
static int caps_lock(const char *s);
static int bcode(const char *s);
static void error(const char *fmt, ...) __attribute__ ((noreturn));
static void error(const char *fmt, ...) ATTRIBUTE_NORETURN;
#ifdef SYSV_STYLE
#ifdef CONFIG_FEATURE_UTMP

View File

@ -928,7 +928,7 @@ static int matchconf (servtab_t *old, servtab_t *new)
return (1);
}
static void config (int sig __attribute__((unused)))
static void config (int sig ATTRIBUTE_UNUSED)
{
servtab_t *sep, *cp, **sepp;
sigset_t omask;
@ -1149,7 +1149,7 @@ static void config (int sig __attribute__((unused)))
}
static void reapchild (int sig __attribute__((unused)))
static void reapchild (int sig ATTRIBUTE_UNUSED)
{
pid_t pid;
int save_errno = errno, status;
@ -1176,7 +1176,7 @@ static void reapchild (int sig __attribute__((unused)))
errno = save_errno;
}
static void retry (int sig __attribute__((unused)))
static void retry (int sig ATTRIBUTE_UNUSED)
{
servtab_t *sep;
@ -1200,7 +1200,7 @@ static void retry (int sig __attribute__((unused)))
}
}
static void goaway (int sig __attribute__((unused)))
static void goaway (int sig ATTRIBUTE_UNUSED)
{
servtab_t *sep;
@ -1582,7 +1582,7 @@ echo_stream (int s, servtab_t *sep)
/* Echo service -- echo data back */
/* ARGSUSED */
static void
echo_dg (int s, servtab_t *sep __attribute__((unused)))
echo_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
char buffer[BUFSIZE];
int i;
@ -1616,7 +1616,7 @@ discard_stream (int s, servtab_t *sep)
/* Discard service -- ignore data */
/* ARGSUSED */
static void
discard_dg (int s, servtab_t *sep __attribute__((unused)))
discard_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
char buffer[BUFSIZE];
@ -1678,7 +1678,7 @@ chargen_stream (int s, servtab_t *sep)
/* Character generator */
/* ARGSUSED */
static void
chargen_dg (int s, servtab_t *sep __attribute__((unused)))
chargen_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
/* struct sockaddr_storage ss; */
struct sockaddr sa;
@ -1735,7 +1735,7 @@ static u_int machtime (void)
/* ARGSUSED */
static void
machtime_stream (int s, servtab_t *sep __attribute__((unused)))
machtime_stream (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
u_int result;
@ -1745,7 +1745,7 @@ machtime_stream (int s, servtab_t *sep __attribute__((unused)))
/* ARGSUSED */
static void
machtime_dg (int s, servtab_t *sep __attribute__((unused)))
machtime_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
u_int result;
/* struct sockaddr_storage ss; */
@ -1770,7 +1770,7 @@ machtime_dg (int s, servtab_t *sep __attribute__((unused)))
#ifdef CONFIG_FEATURE_INETD_SUPPORT_BILTIN_DAYTIME
/* Return human-readable time of day */
/* ARGSUSED */
static void daytime_stream (int s, servtab_t *sep __attribute__((unused)))
static void daytime_stream (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
char buffer[256];
time_t t;
@ -1784,7 +1784,7 @@ static void daytime_stream (int s, servtab_t *sep __attribute__((unused)))
/* Return human-readable time of day */
/* ARGSUSED */
void
daytime_dg (int s, servtab_t *sep __attribute__((unused)))
daytime_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
{
char buffer[256];
time_t t;

View File

@ -1,3 +1,5 @@
#ifndef _IP_COMMON_H
#define _IP_COMMON_H 1
extern int preferred_family;
extern char * _SL_;
@ -5,7 +7,7 @@ extern void ip_parse_common_args(int *argcp, char ***argvp);
extern int print_neigh(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg);
extern int ipaddr_list_or_flush(int argc, char **argv, int flush);
extern int iproute_monitor(int argc, char **argv);
extern void iplink_usage(void) __attribute__((noreturn));
extern void iplink_usage(void) ATTRIBUTE_NORETURN;
extern void ipneigh_reset_filter(void);
extern int do_ipaddr(int argc, char **argv);
extern int do_iproute(int argc, char **argv);
@ -16,3 +18,4 @@ extern int do_iplink(int argc, char **argv);
extern int do_ipmonitor(int argc, char **argv);
extern int do_multiaddr(int argc, char **argv);
extern int do_multiroute(int argc, char **argv);
#endif /* ip_common.h */

View File

@ -63,7 +63,7 @@ static int flush_update(void)
return 0;
}
static int print_route(struct sockaddr_nl *who __attribute__((unused)),
static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;

View File

@ -7,6 +7,7 @@
#include "libnetlink.h"
#include "ll_map.h"
#include "rtm_map.h"
#include "libbb.h"
extern int preferred_family;
extern int show_stats;
@ -26,7 +27,7 @@ extern char * _SL_;
#define SPRINT_BSIZE 64
#define SPRINT_BUF(x) char x[SPRINT_BSIZE]
extern void incomplete_command(void) __attribute__((noreturn));
extern void incomplete_command(void) ATTRIBUTE_NORETURN;
#define NEXT_ARG() do { argv++; if (--argc <= 0) incomplete_command(); } while(0)
@ -76,9 +77,9 @@ extern int get_s8(__s8 *val, char *arg, int base);
extern const char *format_host(int af, int len, void *addr, char *buf, int buflen);
extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen);
void invarg(char *, char *) __attribute__((noreturn));
void duparg(char *, char *) __attribute__((noreturn));
void duparg2(char *, char *) __attribute__((noreturn));
void invarg(char *, char *) ATTRIBUTE_NORETURN;
void duparg(char *, char *) ATTRIBUTE_NORETURN;
void duparg2(char *, char *) ATTRIBUTE_NORETURN;
int matches(char *arg, char *pattern);
extern int inet_addr_match(inet_prefix *a, inet_prefix *b, int bits);

View File

@ -48,7 +48,7 @@ typedef struct mactable_s {
static unsigned long flags;
static void serror(const char *s, ...) __attribute__ ((noreturn));
static void serror(const char *s, ...) ATTRIBUTE_NORETURN;
static void serror(const char *s, ...)
{

View File

@ -281,7 +281,7 @@ struct hostinfo {
struct outdata {
u_char seq; /* sequence number of this packet */
u_char ttl; /* ttl packet left with */
struct timeval tv __attribute__((packed)); /* time packet left */
struct timeval tv ATTRIBUTE_PACKED; /* time packet left */
};
struct IFADDRLIST {

View File

@ -27,7 +27,7 @@ struct arpMsg {
uint8_t tHaddr[6]; /* target's hardware address */
uint8_t tInaddr[4]; /* target's IP address */
uint8_t pad[18]; /* pad for min. Ethernet payload (60 bytes) */
} __attribute__ ((packed));
} ATTRIBUTE_PACKED;
/* function prototypes */
int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface);

View File

@ -4,19 +4,7 @@
*
* Russ Dill <Russ.Dill@asu.edu> July 2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <sys/time.h>
@ -74,7 +62,7 @@ struct client_config_t client_config = {
};
#ifndef IN_BUSYBOX
static void __attribute__ ((noreturn)) show_usage(void)
static void ATTRIBUTE_NORETURN show_usage(void)
{
printf(
"Usage: udhcpc [OPTIONS]\n\n"
@ -101,7 +89,7 @@ static void __attribute__ ((noreturn)) show_usage(void)
}
#else
#define show_usage bb_show_usage
extern void show_usage(void) __attribute__ ((noreturn));
extern void show_usage(void) ATTRIBUTE_NORETURN;
#endif

View File

@ -1,3 +1,7 @@
/* vi: set sw=4 ts=4: */
/*
Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
@ -21,7 +25,7 @@
#ifndef IN_BUSYBOX
static void __attribute__ ((noreturn)) show_usage(void)
static void ATTRIBUTE_NORETURN show_usage(void)
{
printf(
"Usage: dumpleases -f <file> -[r|a]\n\n"

View File

@ -5,20 +5,7 @@
* Copyright (C) 2003 by Arthur van Hoff (avh@strangeberry.com)
* Copyright (C) 2004 by David Brownell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
/*
@ -73,7 +60,7 @@ struct arp_packet {
struct in_addr source_ip;
struct ether_addr target_addr;
struct in_addr target_ip;
} __attribute__ ((__packed__));
} ATTRIBUTE_PACKED;
/* 169.254.0.0 */
static const uint32_t LINKLOCAL_ADDR = 0xa9fe0000;
@ -214,7 +201,7 @@ bad:
/**
* Print usage information.
*/
static void __attribute__((noreturn))
static void ATTRIBUTE_NORETURN
zcip_usage(const char *msg)
{
fprintf(stderr, "%s: %s\n", prog, msg);

View File

@ -12,19 +12,7 @@
* This code is derived from software contributed to Berkeley by
* Kenneth Almquist.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*
* Original BSD copyright notice is retained at the end of this file.
*/
@ -233,11 +221,11 @@ static volatile sig_atomic_t pendingsigs;
/* EXSIG is turned off by evalbltin(). */
static void exraise(int) __attribute__((__noreturn__));
static void onint(void) __attribute__((__noreturn__));
static void exraise(int) ATTRIBUTE_NORETURN;
static void onint(void) ATTRIBUTE_NORETURN;
static void sh_error(const char *, ...) __attribute__((__noreturn__));
static void exerror(int, const char *, ...) __attribute__((__noreturn__));
static void sh_error(const char *, ...) ATTRIBUTE_NORETURN;
static void exerror(int, const char *, ...) ATTRIBUTE_NORETURN;
static void sh_warnx(const char *, ...);
@ -1400,7 +1388,7 @@ struct cmdentry {
static const char *pathopt; /* set by padvance */
static void shellexec(char **, const char *, int)
__attribute__((__noreturn__));
ATTRIBUTE_NORETURN;
static char *padvance(const char **, const char *);
static void find_command(char *, struct cmdentry *, int, const char *);
static struct builtincmd *find_builtin(const char *);
@ -2026,7 +2014,7 @@ static void ignoresig(int);
static void onsig(int);
static int dotrap(void);
static void setinteractive(int);
static void exitshell(void) __attribute__((__noreturn__));
static void exitshell(void) ATTRIBUTE_NORETURN;
static int decode_signal(const char *, int);
/*
@ -2504,7 +2492,7 @@ setpwd(const char *val, int setold)
static void exverror(int, const char *, va_list)
__attribute__((__noreturn__));
ATTRIBUTE_NORETURN;
/*
* Called to raise an exception. Since C doesn't include exceptions, we
@ -4518,7 +4506,7 @@ static size_t esclen(const char *, const char *);
static char *scanleft(char *, char *, char *, char *, int, int);
static char *scanright(char *, char *, char *, char *, int, int);
static void varunset(const char *, const char *, const char *, int)
__attribute__((__noreturn__));
ATTRIBUTE_NORETURN;
#define pmatch(a, b) !fnmatch((a), (b), 0)
@ -9325,8 +9313,8 @@ static int readtoken(void);
static int xxreadtoken(void);
static int readtoken1(int firstc, int syntax, char *eofmark, int striptabs);
static int noexpand(char *);
static void synexpect(int) __attribute__((__noreturn__));
static void synerror(const char *) __attribute__((__noreturn__));
static void synexpect(int) ATTRIBUTE_NORETURN;
static void synerror(const char *) ATTRIBUTE_NORETURN;
static void setprompt(int);

View File

@ -75,19 +75,7 @@
* maybe change map[] to use 2-bit entries
* (eventually) remove all the printf's
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <ctype.h> /* isalpha, isdigit */
#include <unistd.h> /* getpid */
@ -369,7 +357,7 @@ static int free_pipe(struct pipe *pi, int indent);
/* really run the final data structures: */
static int setup_redirects(struct child_prog *prog, int squirrel[]);
static int run_list_real(struct pipe *pi);
static void pseudo_exec(struct child_prog *child) __attribute__ ((noreturn));
static void pseudo_exec(struct child_prog *child) ATTRIBUTE_NORETURN;
static int run_pipe_real(struct pipe *pi);
/* extended glob support: */
static int globhack(const char *src, int flags, glob_t *pglob);

View File

@ -8,20 +8,7 @@
* under the following liberal license: "We have placed this source code in the
* public domain. Use it in any project, free or commercial."
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
/* This shell's parsing engine is officially at a dead-end. Future
@ -148,7 +135,7 @@ static void remove_job(struct jobset *j_list, struct job *job);
static int get_command(FILE * source, char *command);
static int parse_command(char **command_ptr, struct job *job, int *inbg);
static int run_command(struct job *newjob, int inbg, int outpipe[2]);
static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));
static int pseudo_exec(struct child_prog *cmd) ATTRIBUTE_NORETURN;
static int busy_loop(FILE * input);

View File

@ -14,20 +14,7 @@
*
* Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <stdio.h>
@ -51,7 +38,7 @@ static void klogd_signal(int sig)
exit(EXIT_SUCCESS);
}
static void doKlogd(const int console_log_level) __attribute__ ((noreturn));
static void doKlogd(const int console_log_level) ATTRIBUTE_NORETURN;
static void doKlogd(const int console_log_level)
{
int priority = LOG_INFO;

View File

@ -10,20 +10,7 @@
*
* Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
#include <stdio.h>
@ -527,7 +514,7 @@ static int serveConnection(char *tmpbuf, int n_read)
return n_read;
}
static void doSyslogd(void) __attribute__ ((noreturn));
static void doSyslogd(void) ATTRIBUTE_NORETURN;
static void doSyslogd(void)
{
struct sockaddr_un sunx;

View File

@ -2,10 +2,7 @@
*
* Copyright (C) 1992 A. V. Le Blanc (LeBlanc@mcc.ac.uk)
*
* This program is free software. You can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation: either version 1 or
* (at your option) any later version.
* Licensed under the GPL v1 or later, see the file LICENSE in this tarball.
*
* Vladimir Oleynik <dzo@simtreas.ru> 2001,2002 Busybox port
*/
@ -200,7 +197,7 @@ struct partition {
unsigned char end_cyl; /* end cylinder */
unsigned char start4[4]; /* starting sector counting from 0 */
unsigned char size4[4]; /* nr of sectors in partition */
} __attribute__((__packed__));
} ATTRIBUTE_PACKED;
enum failure {
ioctl_error, unable_to_open, unable_to_read, unable_to_seek,
@ -224,7 +221,7 @@ static void list_types(const struct systypes *sys);
static uint read_int(uint low, uint dflt, uint high, uint base, char *mesg);
#endif
static const char *partition_type(unsigned char type);
static void fdisk_fatal(enum failure why) __attribute__ ((noreturn));
static void fdisk_fatal(enum failure why) ATTRIBUTE_NORETURN;
static void get_geometry(void);
static int get_boot(enum action what);

View File

@ -269,7 +269,7 @@ static inline int bit(char * a,unsigned int i)
#define mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE+1),changed=1)
#define unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE+1),changed=1)
static void leave(int) __attribute__ ((noreturn));
static void leave(int) ATTRIBUTE_NORETURN;
static void leave(int status)
{
if (termios_set)