Skip to content

Commit

Permalink
Extend fallthrough safety to LLVM in gmpy2_mpmath.c
Browse files Browse the repository at this point in the history
The current fallthrough comments only suppress warnings for GCC. `__attribute__((fallthrough));` works for both GCC (>=7) and LLVM. C23 will introduce `[[fallthrough]]`.
  • Loading branch information
r-barnes committed Aug 6, 2024
1 parent 7bd27fe commit f8bb1a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gmpy2_mpmath.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,17 +287,17 @@ Pympz_mpmath_create_fast(PyObject *self, PyObject *const *args, Py_ssize_t nargs
switch (nargs) {
case 4:
rnd = PyString_1Char(args[3]);
/* fallthrough */
__attribute__((fallthrough));
case 3:
prec = GMPy_Integer_AsLong(args[2]);
if (prec == (mp_bitcnt_t)(-1)) {
VALUE_ERROR("could not convert prec to positive int");
return NULL;
}
/* fallthrough */
__attribute__((fallthrough));
case 2:
exp = args[1];
/* fallthrough */
__attribute__((fallthrough));
case 1:
man = GMPy_MPZ_From_Integer(args[0], NULL);
if (!man) {
Expand Down

0 comments on commit f8bb1a3

Please sign in to comment.