-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.
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
%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
#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; \
char *end;
errno = 0;
- yylval->uintval = strtoumax(yytext, &end, 0);
+ yylval->uintval = STRTOUMAX(yytext, &end, 0);
if (errno == ERANGE)
lex_error(_("integer constant out of range"));
if (*end)