mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Changes to use attributes for noreturn and printf-like functions
This commit is contained in:
7
decl.h
7
decl.h
@@ -94,12 +94,5 @@
|
||||
|
||||
#endif
|
||||
|
||||
/* Perform printf-style argument type checking for known compilers */
|
||||
#ifdef __GNUC__
|
||||
# define PRINTF_FORMAT(fmt_idx, arg_idx) __attribute__ \
|
||||
((format (printf, fmt_idx, arg_idx)))
|
||||
#else
|
||||
# define PRINTF_FORMAT(fmt_idx, arg_idx)
|
||||
#endif
|
||||
|
||||
#endif /* !INCLUDE_DECL_H */
|
||||
|
2
hist.c
2
hist.c
@@ -137,7 +137,7 @@ S_FUNC void uppercase_word(void);
|
||||
S_FUNC void lowercase_word(void);
|
||||
S_FUNC void ignore_char(void);
|
||||
S_FUNC void arrow_key(void);
|
||||
S_FUNC void quit_calc(void);
|
||||
S_FUNC void quit_calc(void) __attribute__((noreturn));
|
||||
|
||||
|
||||
STATIC FUNC funcs[] =
|
||||
|
4
token.h
4
token.h
@@ -175,8 +175,8 @@ E_FUNC void inittokens(void);
|
||||
E_FUNC int tokenmode(int flag);
|
||||
E_FUNC int gettoken(void);
|
||||
E_FUNC void rescantoken(void);
|
||||
E_FUNC void scanerror(int, char *, ...) PRINTF_FORMAT(2, 3);
|
||||
E_FUNC void warning(char *, ...) PRINTF_FORMAT(1, 2);
|
||||
E_FUNC void scanerror(int, char *, ...) __attribute__((format(printf, 2, 3)));
|
||||
E_FUNC void warning(char *, ...) __attribute__((format(printf, 1, 2)));
|
||||
|
||||
|
||||
#endif /* !INCLUDE_TOKEN_H */
|
||||
|
2
zfunc.c
2
zfunc.c
@@ -1411,7 +1411,7 @@ zlog10(ZVALUE z, BOOL *was_10_power)
|
||||
do {
|
||||
rel = zrel(*zp, z);
|
||||
if (rel == 0) {
|
||||
/* quick exit - we match a tenpower entry */
|
||||
/* quick return - we match a tenpower entry */
|
||||
if (was_10_power != NULL) {
|
||||
*was_10_power = TRUE;
|
||||
}
|
||||
|
7
zmath.h
7
zmath.h
@@ -41,6 +41,7 @@
|
||||
# include "longbits.h"
|
||||
# include "byteswap.h"
|
||||
# include "have_stdlib.h"
|
||||
# include "attribute.h"
|
||||
#else
|
||||
# include <calc/decl.h>
|
||||
# include <calc/alloc.h>
|
||||
@@ -48,6 +49,7 @@
|
||||
# include <calc/longbits.h>
|
||||
# include <calc/byteswap.h>
|
||||
# include <calc/have_stdlib.h>
|
||||
# include <calc/attribute.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
@@ -625,13 +627,14 @@ E_FUNC char *math_getdivertedio(void);
|
||||
E_FUNC int math_setmode(int mode);
|
||||
E_FUNC int math_setmode2(int mode);
|
||||
E_FUNC LEN math_setdigits(LEN digits);
|
||||
E_FUNC void math_fmt(char *, ...) PRINTF_FORMAT(1, 2);
|
||||
E_FUNC void math_fmt(char *, ...) __attribute__((format(printf, 1, 2)));
|
||||
|
||||
|
||||
/*
|
||||
* The error routine.
|
||||
*/
|
||||
E_FUNC void math_error(char *, ...) PRINTF_FORMAT(1, 2);
|
||||
E_FUNC void math_error(char *, ...) \
|
||||
__attribute__((format(printf, 1, 2))) __attribute__((noreturn));
|
||||
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user