mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
gpgscm: Suppress warnings for GCC > 6.
* tests/gpgscm/scheme.c (CASE): Use unused attribute for GCC > 6. (FALLTHROUGH): New for fallthrough. (Eval_Cycle): Use FALLTHROUGH. Remove not-needed comment of fallthrough. -- Since GCC combines C preprocessor macro expansion, the fallthrough comment doesn't work well to suppress warnings for -Wimplicit-fallthrough, near the macro CASE. To handle this problem, we use GCC's extension of unused label and fallthrough attributes. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
625ced6e67
commit
99c17b970b
@ -2990,13 +2990,23 @@ _Error_1(scheme *sc, const char *s, pointer a) {
|
|||||||
/* Define a label OP and emit a case statement for OP. For use in the
|
/* Define a label OP and emit a case statement for OP. For use in the
|
||||||
* dispatch function. The slightly peculiar goto that is never
|
* dispatch function. The slightly peculiar goto that is never
|
||||||
* executed avoids warnings about unused labels. */
|
* executed avoids warnings about unused labels. */
|
||||||
|
#if __GNUC__ > 6
|
||||||
|
#define CASE(OP) OP: __attribute__((unused)); case OP
|
||||||
|
#else
|
||||||
#define CASE(OP) case OP: if (0) goto OP; OP
|
#define CASE(OP) case OP: if (0) goto OP; OP
|
||||||
|
#endif
|
||||||
|
|
||||||
#else /* USE_THREADED_CODE */
|
#else /* USE_THREADED_CODE */
|
||||||
#define s_thread_to(sc, a) s_goto(sc, a)
|
#define s_thread_to(sc, a) s_goto(sc, a)
|
||||||
#define CASE(OP) case OP
|
#define CASE(OP) case OP
|
||||||
#endif /* USE_THREADED_CODE */
|
#endif /* USE_THREADED_CODE */
|
||||||
|
|
||||||
|
#if __GNUC__ > 6
|
||||||
|
#define FALLTHROUGH __attribute__ ((fallthrough))
|
||||||
|
#else
|
||||||
|
#define FALLTHROUGH /* fallthrough */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Return to the previous frame on the dump stack, setting the current
|
/* Return to the previous frame on the dump stack, setting the current
|
||||||
* value to A. */
|
* value to A. */
|
||||||
#define s_return(sc, a) s_goto(sc, _s_return(sc, a, 0))
|
#define s_return(sc, a) s_goto(sc, _s_return(sc, a, 0))
|
||||||
@ -3557,7 +3567,7 @@ Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
|
|||||||
putstr(sc,"\nEval: ");
|
putstr(sc,"\nEval: ");
|
||||||
s_thread_to(sc,OP_P0LIST);
|
s_thread_to(sc,OP_P0LIST);
|
||||||
}
|
}
|
||||||
/* fall through */
|
FALLTHROUGH;
|
||||||
CASE(OP_REAL_EVAL):
|
CASE(OP_REAL_EVAL):
|
||||||
#endif
|
#endif
|
||||||
if (is_symbol(sc->code)) { /* symbol */
|
if (is_symbol(sc->code)) { /* symbol */
|
||||||
@ -3635,7 +3645,7 @@ Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
|
|||||||
free_cons(sc, sc->args, &callsite, &sc->args);
|
free_cons(sc, sc->args, &callsite, &sc->args);
|
||||||
sc->code = car(sc->args);
|
sc->code = car(sc->args);
|
||||||
sc->args = cdr(sc->args);
|
sc->args = cdr(sc->args);
|
||||||
/* Fallthrough. */
|
FALLTHROUGH;
|
||||||
|
|
||||||
CASE(OP_APPLY): /* apply 'code' to 'args' */
|
CASE(OP_APPLY): /* apply 'code' to 'args' */
|
||||||
#if USE_TRACING
|
#if USE_TRACING
|
||||||
@ -3646,7 +3656,7 @@ Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
|
|||||||
putstr(sc,"\nApply to: ");
|
putstr(sc,"\nApply to: ");
|
||||||
s_thread_to(sc,OP_P0LIST);
|
s_thread_to(sc,OP_P0LIST);
|
||||||
}
|
}
|
||||||
/* fall through */
|
FALLTHROUGH;
|
||||||
CASE(OP_REAL_APPLY):
|
CASE(OP_REAL_APPLY):
|
||||||
#endif
|
#endif
|
||||||
#if USE_HISTORY
|
#if USE_HISTORY
|
||||||
@ -3727,12 +3737,11 @@ Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
|
|||||||
s_thread_to(sc,OP_APPLY);
|
s_thread_to(sc,OP_APPLY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Fallthrough. */
|
|
||||||
#else
|
#else
|
||||||
CASE(OP_LAMBDA): /* lambda */
|
CASE(OP_LAMBDA): /* lambda */
|
||||||
sc->value = sc->code;
|
sc->value = sc->code;
|
||||||
/* Fallthrough. */
|
|
||||||
#endif
|
#endif
|
||||||
|
FALLTHROUGH;
|
||||||
|
|
||||||
CASE(OP_LAMBDA1):
|
CASE(OP_LAMBDA1):
|
||||||
gc_disable(sc, 1);
|
gc_disable(sc, 1);
|
||||||
@ -4655,13 +4664,9 @@ Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
|
|||||||
CASE(OP_NULLP): /* null? */
|
CASE(OP_NULLP): /* null? */
|
||||||
s_retbool(car(sc->args) == sc->NIL);
|
s_retbool(car(sc->args) == sc->NIL);
|
||||||
CASE(OP_NUMEQ): /* = */
|
CASE(OP_NUMEQ): /* = */
|
||||||
/* Fallthrough. */
|
|
||||||
CASE(OP_LESS): /* < */
|
CASE(OP_LESS): /* < */
|
||||||
/* Fallthrough. */
|
|
||||||
CASE(OP_GRE): /* > */
|
CASE(OP_GRE): /* > */
|
||||||
/* Fallthrough. */
|
|
||||||
CASE(OP_LEQ): /* <= */
|
CASE(OP_LEQ): /* <= */
|
||||||
/* Fallthrough. */
|
|
||||||
CASE(OP_GEQ): /* >= */
|
CASE(OP_GEQ): /* >= */
|
||||||
switch(op) {
|
switch(op) {
|
||||||
case OP_NUMEQ: comp_func=num_eq; break;
|
case OP_NUMEQ: comp_func=num_eq; break;
|
||||||
@ -4750,9 +4755,7 @@ Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
|
|||||||
s_return(sc,sc->value);
|
s_return(sc,sc->value);
|
||||||
|
|
||||||
CASE(OP_WRITE): /* write */
|
CASE(OP_WRITE): /* write */
|
||||||
/* Fallthrough. */
|
|
||||||
CASE(OP_DISPLAY): /* display */
|
CASE(OP_DISPLAY): /* display */
|
||||||
/* Fallthrough. */
|
|
||||||
CASE(OP_WRITE_CHAR): /* write-char */
|
CASE(OP_WRITE_CHAR): /* write-char */
|
||||||
if(is_pair(cdr(sc->args))) {
|
if(is_pair(cdr(sc->args))) {
|
||||||
if(cadr(sc->args)!=sc->outport) {
|
if(cadr(sc->args)!=sc->outport) {
|
||||||
@ -4900,9 +4903,7 @@ Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
|
|||||||
s_return(sc,sc->outport);
|
s_return(sc,sc->outport);
|
||||||
|
|
||||||
CASE(OP_OPEN_INFILE): /* open-input-file */
|
CASE(OP_OPEN_INFILE): /* open-input-file */
|
||||||
/* Fallthrough. */
|
|
||||||
CASE(OP_OPEN_OUTFILE): /* open-output-file */
|
CASE(OP_OPEN_OUTFILE): /* open-output-file */
|
||||||
/* Fallthrough. */
|
|
||||||
CASE(OP_OPEN_INOUTFILE): /* open-input-output-file */ {
|
CASE(OP_OPEN_INOUTFILE): /* open-input-output-file */ {
|
||||||
int prop=0;
|
int prop=0;
|
||||||
pointer p;
|
pointer p;
|
||||||
@ -4922,7 +4923,6 @@ Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
|
|||||||
|
|
||||||
#if USE_STRING_PORTS
|
#if USE_STRING_PORTS
|
||||||
CASE(OP_OPEN_INSTRING): /* open-input-string */
|
CASE(OP_OPEN_INSTRING): /* open-input-string */
|
||||||
/* Fallthrough. */
|
|
||||||
CASE(OP_OPEN_INOUTSTRING): /* open-input-output-string */ {
|
CASE(OP_OPEN_INOUTSTRING): /* open-input-output-string */ {
|
||||||
int prop=0;
|
int prop=0;
|
||||||
pointer p;
|
pointer p;
|
||||||
@ -5003,7 +5003,6 @@ Eval_Cycle(scheme *sc, enum scheme_opcodes op) {
|
|||||||
s_thread_to(sc,OP_READ_INTERNAL);
|
s_thread_to(sc,OP_READ_INTERNAL);
|
||||||
|
|
||||||
CASE(OP_READ_CHAR): /* read-char */
|
CASE(OP_READ_CHAR): /* read-char */
|
||||||
/* Fallthrough. */
|
|
||||||
CASE(OP_PEEK_CHAR): /* peek-char */ {
|
CASE(OP_PEEK_CHAR): /* peek-char */ {
|
||||||
int c;
|
int c;
|
||||||
if(is_pair(sc->args)) {
|
if(is_pair(sc->args)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user