Replace __LA_DEAD with __LA_NORETURN (#2000)

Also add the MSC_VER version of the macro.
This commit is contained in:
AtariDreams authored and GitHub committed 2023-12-04 08:29:29 -08:00
1 parent be09cb72c2
commit 616c7dca2b
15 files changed
+60 -48

No files matched your search

+6 -2
View File
@@ -129,12 +129,16 @@ main(int argc, char **argv)
switch (c) {
case 'h':
usage(stdout, 0);
break;
/* NOTREACHED */
/* Fallthrough */
case OPTION_VERSION:
version();
break;
/* NOTREACHED */
/* Fallthrough */
default:
usage(stderr, 1);
/* Fallthrough */
/* NOTREACHED */
}
}
+7 -5
View File
@@ -52,12 +52,14 @@
/* How to mark functions that don't return. */
/* This facilitates use of some newer static code analysis tools. */
#undef __LA_DEAD
#undef __LA_NORETURN
#if defined(__GNUC__) && (__GNUC__ > 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_DEAD __attribute__((__noreturn__))
#else
#define __LA_DEAD
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_NORETURN __attribute__((__noreturn__))
#elif defined(_MSC_VER)
#define __LA_NORETURN __declspec(noreturn)
#else
#define __LA_NORETURN
#endif
#endif /* !BSDCAT_PLATFORM_H_INCLUDED */
+8 -8
View File
@@ -107,22 +107,22 @@ static int entry_to_archive(struct cpio *, struct archive_entry *);
static int file_to_archive(struct cpio *, const char *);
static void free_cache(struct name_cache *cache);
static void list_item_verbose(struct cpio *, struct archive_entry *);
static void long_help(void) __LA_DEAD;
static void long_help(void) __LA_NORETURN;
static const char *lookup_gname(struct cpio *, gid_t gid);
static int lookup_gname_helper(struct cpio *,
const char **name, id_t gid);
static const char *lookup_uname(struct cpio *, uid_t uid);
static int lookup_uname_helper(struct cpio *,
const char **name, id_t uid);
static void mode_in(struct cpio *) __LA_DEAD;
static void mode_list(struct cpio *) __LA_DEAD;
static void mode_in(struct cpio *) __LA_NORETURN;
static void mode_list(struct cpio *) __LA_NORETURN;
static void mode_out(struct cpio *);
static void mode_pass(struct cpio *, const char *);
static const char *remove_leading_slash(const char *);
static int restore_time(struct cpio *, struct archive_entry *,
const char *, int fd);
static void usage(void) __LA_DEAD;
static void version(void) __LA_DEAD;
static void usage(void) __LA_NORETURN;
static void version(void) __LA_NORETURN;
static const char * passphrase_callback(struct archive *, void *);
static void passphrase_free(char *);
@@ -250,7 +250,7 @@ main(int argc, char *argv[])
break;
case 'h':
long_help();
break;
/* NOTREACHED */
case 'I': /* NetBSD/OpenBSD */
cpio->filename = cpio->argument;
break;
@@ -357,7 +357,7 @@ main(int argc, char *argv[])
break;
case OPTION_VERSION: /* GNU convention */
version();
break;
/* NOTREACHED */
#if 0
/*
* cpio_getopt() handles -W specially, so it's not
@@ -426,7 +426,7 @@ main(int argc, char *argv[])
mode_list(cpio);
else
mode_in(cpio);
break;
/* NOTREACHED */
case 'p':
if (*cpio->argv == NULL || **cpio->argv == '\0')
lafe_errc(1, 0,
+4 -2
View File
@@ -57,9 +57,11 @@
/* How to mark functions that don't return. */
#if defined(__GNUC__) && (__GNUC__ > 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_DEAD __attribute__((__noreturn__))
#define __LA_NORETURN __attribute__((__noreturn__))
#elif defined(_MSC_VER)
#define __LA_NORETURN __declspec(noreturn)
#else
#define __LA_DEAD
#define __LA_NORETURN
#endif
#endif /* !CPIO_PLATFORM_H_INCLUDED */
+1 -1
View File
@@ -61,7 +61,7 @@ errmsg(const char *m)
}
}
static __LA_DEAD void
static __LA_NORETURN void
diediedie(void)
{
#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)
+6 -4
View File
@@ -38,10 +38,12 @@
#include "archive_string.h"
#if defined(__GNUC__) && (__GNUC__ > 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_DEAD __attribute__((__noreturn__))
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_NORETURN __attribute__((__noreturn__))
#elif defined(_MSC_VER)
#define __LA_NORETURN __declspec(noreturn)
#else
#define __LA_DEAD
#define __LA_NORETURN
#endif
#if defined(__GNUC__) && (__GNUC__ > 2 || \
@@ -151,7 +153,7 @@ int __archive_check_magic(struct archive *, unsigned int magic,
return ARCHIVE_FATAL; \
} while (0)
void __archive_errx(int retvalue, const char *msg) __LA_DEAD;
void __archive_errx(int retvalue, const char *msg) __LA_NORETURN;
void __archive_ensure_cloexec_flag(int fd);
int __archive_mktemp(const char *tmpdir);
+6 -4
View File
@@ -27,10 +27,12 @@
#define LAFE_ERR_H
#if defined(__GNUC__) && (__GNUC__ > 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_DEAD __attribute__((__noreturn__))
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_NORETURN __attribute__((__noreturn__))
#elif defined(_MSC_VER)
#define __LA_NORETURN __declspec(noreturn)
#else
#define __LA_DEAD
#define __LA_NORETURN
#endif
#if defined(__GNUC__) && (__GNUC__ > 2 || \
@@ -46,7 +48,7 @@
#endif
void lafe_warnc(int code, const char *fmt, ...) __LA_PRINTFLIKE(2, 3);
void lafe_errc(int eval, int code, const char *fmt, ...) __LA_DEAD
void lafe_errc(int eval, int code, const char *fmt, ...) __LA_NORETURN
__LA_PRINTFLIKE(3, 4);
const char * lafe_getprogname(void);
+1 -1
View File
@@ -329,7 +329,7 @@ lafe_readpassphrase(const char *prompt, char *buf, size_t bufsiz)
break;
default:
lafe_errc(1, errno, "Couldn't read passphrase");
break;
/* NOTREACHED */
}
}
return (p);
+4 -6
View File
@@ -113,11 +113,11 @@ need_report(void)
}
#endif
static void long_help(void) __LA_DEAD;
static void long_help(void) __LA_NORETURN;
static void only_mode(struct bsdtar *, const char *opt,
const char *valid);
static void set_mode(struct bsdtar *, char opt);
static void version(void) __LA_DEAD;
static void version(void) __LA_NORETURN;
/* A basic set of security flags to request from libarchive. */
#define SECURITY \
@@ -399,8 +399,7 @@ main(int argc, char **argv)
break;
case OPTION_HELP: /* GNU tar, others */
long_help();
exit(0);
break;
/* NOTREACHED*/
case OPTION_HFS_COMPRESSION: /* Mac OS X v10.6 or later */
bsdtar->extract_flags |=
ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED;
@@ -737,7 +736,7 @@ main(int argc, char **argv)
break;
case OPTION_VERSION: /* GNU convention */
version();
break;
/* NOTREACHED */
#if 0
/*
* The -W longopt feature is handled inside of
@@ -803,7 +802,6 @@ main(int argc, char **argv)
/* If no "real" mode was specified, treat -h as --help. */
if ((bsdtar->mode == '\0') && possible_help_request) {
long_help();
exit(0);
}
/* Otherwise, a mode is required. */
+1 -1
View File
@@ -206,7 +206,7 @@ void tar_mode_r(struct bsdtar *bsdtar);
void tar_mode_t(struct bsdtar *bsdtar);
void tar_mode_u(struct bsdtar *bsdtar);
void tar_mode_x(struct bsdtar *bsdtar);
void usage(void) __LA_DEAD;
void usage(void) __LA_NORETURN;
int yes(const char *fmt, ...) __LA_PRINTF(1, 2);
#if defined(HAVE_REGEX_H) || defined(HAVE_PCREPOSIX_H)
+7 -5
View File
@@ -109,12 +109,14 @@
/* How to mark functions that don't return. */
/* This facilitates use of some newer static code analysis tools. */
#undef __LA_DEAD
#undef __LA_NORETURN
#if defined(__GNUC__) && (__GNUC__ > 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_DEAD __attribute__((__noreturn__))
#else
#define __LA_DEAD
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_NORETURN __attribute__((__noreturn__))
#elif defined(_MSC_VER)
#define __LA_NORETURN __declspec(noreturn)
#else
#define __LA_NORETURN
#endif
#endif /* !BSDTAR_PLATFORM_H_INCLUDED */
+1
View File
@@ -158,6 +158,7 @@ add_substitution(struct bsdtar *bsdtar, const char *rule_text)
break;
default:
lafe_errc(1, 0, "Invalid replacement flag %c", *end_pattern);
/* NOTREACHED */
}
}
}
-1
View File
@@ -4175,7 +4175,6 @@ main(int argc, char **argv)
free(refdir_alloc);
free(testprogdir);
usage(progname);
return (1);
}
for (i = 0; i < test_num; i++) {
tests_run++;
+1 -3
View File
@@ -1230,10 +1230,8 @@ main(int argc, char *argv[])
*/
nopts = getopts(argc, argv);
if (version_opt == 1) {
if (version_opt == 1)
version();
exit(EXIT_SUCCESS);
}
/*
* When more of the zipinfo mode options are implemented, this
+7 -5
View File
@@ -52,12 +52,14 @@
/* How to mark functions that don't return. */
/* This facilitates use of some newer static code analysis tools. */
#undef __LA_DEAD
#undef __LA_NORETURN
#if defined(__GNUC__) && (__GNUC__ > 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_DEAD __attribute__((__noreturn__))
#else
#define __LA_DEAD
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define __LA_NORETURN __attribute__((__noreturn__))
#elif defined(_MSC_VER)
#define __LA_NORETURN __declspec(noreturn)
#else
#define __LA_NORETURN
#endif
#endif /* !BSDUNZIP_PLATFORM_H_INCLUDED */