Skip to content

Commit f239678

Browse files
author
ripley
committed
warn about placing of NORET (which is not documented as part of the API
git-svn-id: https://svn.r-project.org/R/trunk@87751 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent a0ef774 commit f239678

File tree

3 files changed

+82
-13
lines changed

3 files changed

+82
-13
lines changed

configure

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8095,8 +8095,8 @@ CC_save=${CC}
80958095
CFLAGS_save=${CFLAGS}
80968096
CC_SUB=`echo "${CC}" | sed 's/-std=[^ ]*//'`
80978097
CFLAGS_SUB=`echo "${CFLAGS}" | sed -e 's/-std=[^ ]*//'`
8098-
: ${CC23="${CC_SUB} -std=gnu23"}
80998098
: ${C23FLAGS="${CFLAGS_SUB}"}
8099+
: ${CC23="${CC_SUB}"}
81008100
CC=${CC23}
81018101
CFLAGS=${C23FLAGS}
81028102
unset r_cv_C23
@@ -8149,10 +8149,64 @@ fi
81498149
printf "%s\n" "$r_cv_C23" >&6; }
81508150

81518151
if test x${r_cv_C23} = xno; then
8152-
unset r_cv_C23
8153-
CC23="${CC_SUB} -std=gnu2x"
8154-
CC=${CC23}
8155-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${CC} is a C23 compiler" >&5
8152+
${CC23="${CC_SUB} -std=gnu23"}
8153+
CC=${CC23}
8154+
CFLAGS=${C23FLAGS}
8155+
unset r_cv_C23
8156+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${CC} is a C23 compiler" >&5
8157+
printf %s "checking whether ${CC} is a C23 compiler... " >&6; }
8158+
if test ${r_cv_C23+y}
8159+
then :
8160+
printf %s "(cached) " >&6
8161+
else case e in #(
8162+
e) if test "$cross_compiling" = yes
8163+
then :
8164+
r_cv_C23=no
8165+
else case e in #(
8166+
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8167+
/* end confdefs.h. */
8168+
8169+
#ifdef __STDC_VERSION__
8170+
# if __STDC_VERSION__ < 202000L
8171+
# error "Compiler does not claim C23 conformance"
8172+
# endif
8173+
#else
8174+
# error "Compiler does not advertise ISO C conformance"
8175+
#endif
8176+
8177+
// Most new features have feature tests. but bool type is fundamental.
8178+
8179+
int main(void) {
8180+
bool x = true;
8181+
8182+
return 0;
8183+
}
8184+
8185+
8186+
_ACEOF
8187+
if ac_fn_c_try_run "$LINENO"
8188+
then :
8189+
r_cv_C23=yes
8190+
else case e in #(
8191+
e) r_cv_C23=no ;;
8192+
esac
8193+
fi
8194+
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
8195+
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
8196+
esac
8197+
fi
8198+
;;
8199+
esac
8200+
fi
8201+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $r_cv_C23" >&5
8202+
printf "%s\n" "$r_cv_C23" >&6; }
8203+
8204+
fi
8205+
if test x${r_cv_C23} = xno; then
8206+
unset r_cv_C23
8207+
CC23="${CC_SUB} -std=gnu2x"
8208+
CC=${CC23}
8209+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${CC} is a C23 compiler" >&5
81568210
printf %s "checking whether ${CC} is a C23 compiler... " >&6; }
81578211
if test ${r_cv_C23+y}
81588212
then :
@@ -27529,7 +27583,7 @@ _ACEOF
2752927583
# flags.
2753027584
r_save_CFLAGS=$CFLAGS
2753127585
CFLAGS="$CFLAGS $r_verb"
27532-
(eval echo $as_me:27532: \"$ac_link\") >&5
27586+
(eval echo $as_me:27586: \"$ac_link\") >&5
2753327587
r_c_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
2753427588
echo "$r_c_v_output" >&5
2753527589
CFLAGS=$r_save_CFLAGS
@@ -27607,7 +27661,7 @@ _ACEOF
2760727661
# flags.
2760827662
r_save_CFLAGS=$CFLAGS
2760927663
CFLAGS="$CFLAGS $r_cv_prog_c_v"
27610-
(eval echo $as_me:27610: \"$ac_link\") >&5
27664+
(eval echo $as_me:27664: \"$ac_link\") >&5
2761127665
r_c_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
2761227666
echo "$r_c_v_output" >&5
2761327667
CFLAGS=$r_save_CFLAGS

configure.ac

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -756,18 +756,26 @@ CC_save=${CC}
756756
CFLAGS_save=${CFLAGS}
757757
CC_SUB=`echo "${CC}" | sed 's/-std=[[^ ]]*//'`
758758
CFLAGS_SUB=`echo "${CFLAGS}" | sed -e 's/-std=[[^ ]]*//'`
759-
dnl this is a hack until -std=gnu23 is widely accepted.
760-
: ${CC23="${CC_SUB} -std=gnu23"}
761759
: ${C23FLAGS="${CFLAGS_SUB}"}
760+
dnl first try without a flag for the likes of gcc15
761+
: ${CC23="${CC_SUB}"}
762762
CC=${CC23}
763763
CFLAGS=${C23FLAGS}
764764
unset r_cv_C23
765765
R_C23
766766
if test x${r_cv_C23} = xno; then
767-
unset r_cv_C23
768-
CC23="${CC_SUB} -std=gnu2x"
769-
CC=${CC23}
770-
R_C23
767+
${CC23="${CC_SUB} -std=gnu23"}
768+
CC=${CC23}
769+
CFLAGS=${C23FLAGS}
770+
unset r_cv_C23
771+
R_C23
772+
fi
773+
if test x${r_cv_C23} = xno; then
774+
dnl this is a hack until -std=gnu23 is widely accepted.
775+
unset r_cv_C23
776+
CC23="${CC_SUB} -std=gnu2x"
777+
CC=${CC23}
778+
R_C23
771779
fi
772780
if test x${r_cv_C23} = xno; then
773781
CC23=

src/include/R_ext/Error.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ extern "C" {
5050
*
5151
* In C11 there is _Noreturn * (or noreturn in header <stdnoreturn.h>).
5252
*/
53+
54+
/*
55+
* As this is sometimes an attribute, it should precede 'static' in a
56+
* function declaration.
57+
* gcc pre-15 requires it to precede 'attribute_hidden'.
58+
* OTOH, '_Noreturn' is an obsolescent (in C23) function specifier.
59+
*/
5360
#if defined NORET
5461
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202301L)
5562
# define NORET [[noreturn]]

0 commit comments

Comments
 (0)