summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4dd9ed3)
We already do something similar in the test suite. We don't really care
about the full range of uintmax_t, we just prefer the widest type that
is available to us. It is no real problem to fall back to a narrower
conversion function.
-dnl Copyright © 2011-2013, 2020-2022 Nick Bowler
+dnl Copyright © 2011-2013, 2020-2023 Nick Bowler
dnl
dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
dnl This is free software: you are free to do what the fuck you want to.
dnl
dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
dnl This is free software: you are free to do what the fuck you want to.
AC_CONFIG_TESTDIR([.], [test:.])
DX_PROG_AUTOTEST
AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
AC_CONFIG_TESTDIR([.], [test:.])
DX_PROG_AUTOTEST
AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
-AC_CHECK_FUNCS_ONCE([strtoull __strtoull])
+AC_CHECK_FUNCS_ONCE([strtoumax strtoull __strtoull])
AC_CONFIG_FILES([
Makefile
AC_CONFIG_FILES([
Makefile
%top{
/*
* Scanner for C declarations.
%top{
/*
* Scanner for C declarations.
- * Copyright © 2011 Nick Bowler
+ * Copyright © 2011, 2021, 2023 Nick Bowler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "cdecl-internal.h"
#include "cdecl.h"
#include "cdecl-internal.h"
#include "cdecl.h"
+#if HAVE_STRTOUMAX
+/* Best case, implementation provides strtoumax. */
+# define STRTOUMAX strtoumax
+#elif HAVE_STRTOULL
+/* Fall back to strtoull, with possibly reduced range. */
+#define STRTOUMAX strtoull
+#elif HAVE___STRTOULL
+/* HP-UX 11 has __strtoull in <inttypes.h> */
+#define STRTOUMAX __strtoull
+#else
+/* Fall back to strtoul, with possibly reduced range. */
+#define STRTOUMAX strtoul
+#endif
+
#define lex_error(...) do { \
cdecl__err(CDECL_ENOPARSE, __VA_ARGS__); \
return T_LEX_ERROR; \
#define lex_error(...) do { \
cdecl__err(CDECL_ENOPARSE, __VA_ARGS__); \
return T_LEX_ERROR; \
- yylval->uintval = strtoumax(yytext, &end, 0);
+ yylval->uintval = STRTOUMAX(yytext, &end, 0);
if (errno == ERANGE)
lex_error(_("integer constant out of range"));
if (*end)
if (errno == ERANGE)
lex_error(_("integer constant out of range"));
if (*end)