Rename attribute macros to namespaced RC_*
This conflicts with linux-headers which uses __unused for some padding members on ppc64le at least. Closes: https://github.com/OpenRC/openrc/issues/622
This commit is contained in:
parent
0b5cb3abcb
commit
eb8831a141
@ -13,13 +13,8 @@
|
|||||||
#ifndef __EINFO_H__
|
#ifndef __EINFO_H__
|
||||||
#define __EINFO_H__
|
#define __EINFO_H__
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#define EINFO_PRINTF(a, b) __attribute__((__format__(__printf__, a, b)))
|
||||||
# define EINFO_PRINTF(a, b) __attribute__((__format__(__printf__, a, b)))
|
#define EINFO_XPRINTF(a, b) __attribute__((__noreturn__, __format__(__printf__, a, b)))
|
||||||
# define EINFO_XPRINTF(a, b) __attribute__((__noreturn__,__format__(__printf__, a, b)))
|
|
||||||
#else
|
|
||||||
# define EINFO_PRINTF(a, b)
|
|
||||||
# define EINFO_XPRINTF(a, b)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -127,7 +127,7 @@ rc_getline(char **line, size_t *len, FILE *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
rc_proc_getent(const char *ent _unused)
|
rc_proc_getent(const char *ent RC_UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -249,7 +249,7 @@ detect_prefix(const char *systype)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
detect_container(const char *systype _unused)
|
detect_container(const char *systype RC_UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
if (systype) {
|
if (systype) {
|
||||||
@ -313,7 +313,7 @@ detect_container(const char *systype _unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
detect_vm(const char *systype _unused)
|
detect_vm(const char *systype RC_UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef __NetBSD__
|
#ifdef __NetBSD__
|
||||||
if (systype) {
|
if (systype) {
|
||||||
|
@ -42,8 +42,7 @@ static sigjmp_buf jbuf;
|
|||||||
/*
|
/*
|
||||||
* Alarm handler
|
* Alarm handler
|
||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
RC_NORETURN static void handler(int arg RC_UNUSED)
|
||||||
_noreturn static void handler(int arg _unused)
|
|
||||||
{
|
{
|
||||||
siglongjmp(jbuf, 1);
|
siglongjmp(jbuf, 1);
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ static void sleep_no_interrupt(int seconds)
|
|||||||
duration = remaining;
|
duration = remaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
_noreturn static void stop_shutdown(int sig)
|
RC_NORETURN static void stop_shutdown(int sig)
|
||||||
{
|
{
|
||||||
(void) sig;
|
(void) sig;
|
||||||
unlink(nologin_file);
|
unlink(nologin_file);
|
||||||
|
@ -690,7 +690,7 @@ do_start_services(const RC_STRINGLIST *start_services, bool parallel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RC_DEBUG
|
#ifdef RC_DEBUG
|
||||||
_noreturn static void
|
RC_NORETURN static void
|
||||||
handle_bad_signal(int sig)
|
handle_bad_signal(int sig)
|
||||||
{
|
{
|
||||||
char pid[10];
|
char pid[10];
|
||||||
|
@ -36,7 +36,7 @@ void set_quiet_options(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_noreturn void show_version(void)
|
RC_NORETURN void show_version(void)
|
||||||
{
|
{
|
||||||
const char *systype = NULL;
|
const char *systype = NULL;
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ _noreturn void show_version(void)
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
_noreturn void usage(int exit_status)
|
RC_NORETURN void usage(int exit_status)
|
||||||
{
|
{
|
||||||
const char * const has_arg[] = { "", "<arg>", "[arg]" };
|
const char * const has_arg[] = { "", "<arg>", "[arg]" };
|
||||||
int i;
|
int i;
|
||||||
|
@ -30,20 +30,9 @@
|
|||||||
|
|
||||||
#define UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
#define UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||||
|
|
||||||
#ifdef lint
|
#define RC_UNUSED __attribute__((__unused__))
|
||||||
# define _unused
|
#define RC_NORETURN __attribute__((__noreturn__))
|
||||||
#endif
|
#define RC_PRINTF(a, b) __attribute__((__format__(__printf__, a, b)))
|
||||||
#if __GNUC__ > 2 || defined(__INTEL_COMPILER)
|
|
||||||
# define _dead __attribute__((__noreturn__))
|
|
||||||
# define _noreturn __attribute__ ((__noreturn__))
|
|
||||||
# define _unused __attribute__((__unused__))
|
|
||||||
# define _xasprintf(a, b) __attribute__((__format__(__printf__, a, b)))
|
|
||||||
#else
|
|
||||||
# define _dead
|
|
||||||
# define _noreturn
|
|
||||||
# define _unused
|
|
||||||
# define _xasprintf(a, b)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||||
|
|
||||||
@ -65,7 +54,7 @@
|
|||||||
} while (/* CONSTCOND */ 0)
|
} while (/* CONSTCOND */ 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_unused static void *xmalloc (size_t size)
|
RC_UNUSED static void *xmalloc (size_t size)
|
||||||
{
|
{
|
||||||
void *value = malloc(size);
|
void *value = malloc(size);
|
||||||
|
|
||||||
@ -76,7 +65,7 @@ _unused static void *xmalloc (size_t size)
|
|||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
_unused static void *xrealloc(void *ptr, size_t size)
|
RC_UNUSED static void *xrealloc(void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
void *value = realloc(ptr, size);
|
void *value = realloc(ptr, size);
|
||||||
|
|
||||||
@ -87,7 +76,7 @@ _unused static void *xrealloc(void *ptr, size_t size)
|
|||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
_unused static char *xstrdup(const char *str)
|
RC_UNUSED static char *xstrdup(const char *str)
|
||||||
{
|
{
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
@ -109,7 +98,7 @@ _unused static char *xstrdup(const char *str)
|
|||||||
* basename_c never modifies the argument. As such, if there is a trailing
|
* basename_c never modifies the argument. As such, if there is a trailing
|
||||||
* slash then an empty string is returned.
|
* slash then an empty string is returned.
|
||||||
*/
|
*/
|
||||||
_unused static const char *basename_c(const char *path)
|
RC_UNUSED static const char *basename_c(const char *path)
|
||||||
{
|
{
|
||||||
const char *slash = strrchr(path, '/');
|
const char *slash = strrchr(path, '/');
|
||||||
|
|
||||||
@ -118,14 +107,14 @@ _unused static const char *basename_c(const char *path)
|
|||||||
return (path);
|
return (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
_unused static bool exists(const char *pathname)
|
RC_UNUSED static bool exists(const char *pathname)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
return (stat(pathname, &buf) == 0);
|
return (stat(pathname, &buf) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_unused static bool existss(const char *pathname)
|
RC_UNUSED static bool existss(const char *pathname)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
@ -140,7 +129,7 @@ _unused static bool existss(const char *pathname)
|
|||||||
* functions to handle memory allocation.
|
* functions to handle memory allocation.
|
||||||
* this function was originally written by Mike Frysinger.
|
* this function was originally written by Mike Frysinger.
|
||||||
*/
|
*/
|
||||||
_unused _xasprintf(2,3) static int xasprintf(char **strp, const char *fmt, ...)
|
RC_UNUSED RC_PRINTF(2,3) static int xasprintf(char **strp, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int len;
|
int len;
|
||||||
|
@ -179,9 +179,9 @@ extern char **environ;
|
|||||||
# define SYS_ioprio_set __NR_ioprio_set
|
# define SYS_ioprio_set __NR_ioprio_set
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__DragonFly__)
|
#if !defined(__DragonFly__)
|
||||||
static inline int ioprio_set(int which _unused,
|
static inline int ioprio_set(int which RC_UNUSED,
|
||||||
int who _unused,
|
int who RC_UNUSED,
|
||||||
int ioprio _unused)
|
int ioprio RC_UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef SYS_ioprio_set
|
#ifdef SYS_ioprio_set
|
||||||
return syscall(SYS_ioprio_set, which, who, ioprio);
|
return syscall(SYS_ioprio_set, which, who, ioprio);
|
||||||
|
@ -192,8 +192,8 @@ extern char **environ;
|
|||||||
# define SYS_ioprio_set __NR_ioprio_set
|
# define SYS_ioprio_set __NR_ioprio_set
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__DragonFly__)
|
#if !defined(__DragonFly__)
|
||||||
static inline int ioprio_set(int which _unused, int who _unused,
|
static inline int ioprio_set(int which RC_UNUSED, int who RC_UNUSED,
|
||||||
int ioprio _unused)
|
int ioprio RC_UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef SYS_ioprio_set
|
#ifdef SYS_ioprio_set
|
||||||
return syscall(SYS_ioprio_set, which, who, ioprio);
|
return syscall(SYS_ioprio_set, which, who, ioprio);
|
||||||
@ -208,7 +208,7 @@ static void cleanup(void)
|
|||||||
free(changeuser);
|
free(changeuser);
|
||||||
}
|
}
|
||||||
|
|
||||||
_noreturn static void re_exec_supervisor(void)
|
RC_NORETURN static void re_exec_supervisor(void)
|
||||||
{
|
{
|
||||||
syslog(LOG_WARNING, "Re-executing for %s", svcname);
|
syslog(LOG_WARNING, "Re-executing for %s", svcname);
|
||||||
execlp("supervise-daemon", "supervise-daemon", svcname, "--reexec",
|
execlp("supervise-daemon", "supervise-daemon", svcname, "--reexec",
|
||||||
@ -354,7 +354,7 @@ static pid_t exec_command(const char *cmd)
|
|||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
_noreturn static void child_process(char *exec, char **argv)
|
RC_NORETURN static void child_process(char *exec, char **argv)
|
||||||
{
|
{
|
||||||
RC_STRINGLIST *env_list;
|
RC_STRINGLIST *env_list;
|
||||||
RC_STRING *env;
|
RC_STRING *env;
|
||||||
@ -587,7 +587,7 @@ _noreturn static void child_process(char *exec, char **argv)
|
|||||||
eerrorx("%s: failed to exec `%s': %s", applet, exec,strerror(errno));
|
eerrorx("%s: failed to exec `%s': %s", applet, exec,strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
_noreturn static void supervisor(char *exec, char **argv)
|
RC_NORETURN static void supervisor(char *exec, char **argv)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
|
Loading…
Reference in New Issue
Block a user