mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
glr2.cc: remove usage of PTRDIFF_MAX
* data/skeletons/glr2.cc: Use std::ptrdiff_t and numeric_limits.
This commit is contained in:
committed by
Akim Demaille
parent
1c5b05ad31
commit
8bfc319f8e
12
TODO
12
TODO
@@ -162,18 +162,6 @@ Line -1 and -3 should mention CATEGORIE, not CATEGORY.
|
|||||||
*** glr.c
|
*** glr.c
|
||||||
Get rid of scaffolding in glr.c.
|
Get rid of scaffolding in glr.c.
|
||||||
|
|
||||||
*** pragmas in glr2.cc
|
|
||||||
Remove the pragmas that disable some warnings:
|
|
||||||
|
|
||||||
// On MacOS, PTRDIFF_MAX is defined as long long, which Clang's
|
|
||||||
// -pedantic reports as being a C++11 extension.
|
|
||||||
#if defined __APPLE__ && YY_CPLUSPLUS < 201103L \
|
|
||||||
&& defined __clang__ && 4 <= __clang_major__
|
|
||||||
# pragma clang diagnostic ignored "-Wc++11-long-long"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
We should use clean C++ code.
|
|
||||||
|
|
||||||
*** namespaces in glr2.cc
|
*** namespaces in glr2.cc
|
||||||
StrongIndexAlias should be in the parser's namespace. Possibly even an
|
StrongIndexAlias should be in the parser's namespace. Possibly even an
|
||||||
inner class.
|
inner class.
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ b4_percent_code_get([[requires]])[
|
|||||||
#include <cstring> // memcpy
|
#include <cstring> // memcpy
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <limits>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -144,13 +145,6 @@ b4_percent_code_get([[requires]])[
|
|||||||
]b4_cast_define[
|
]b4_cast_define[
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
|
|
||||||
// On MacOS, PTRDIFF_MAX is defined as long long, which Clang's
|
|
||||||
// -pedantic reports as being a C++11 extension.
|
|
||||||
#if defined __APPLE__ && YY_CPLUSPLUS < 201103L \
|
|
||||||
&& defined __clang__ && 4 <= __clang_major__
|
|
||||||
# pragma clang diagnostic ignored "-Wc++11-long-long"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename Parameter>
|
template <typename Parameter>
|
||||||
class StrongIndexAlias
|
class StrongIndexAlias
|
||||||
{
|
{
|
||||||
@@ -211,12 +205,16 @@ class StrongIndexAlias
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const ptrdiff_t INVALID_INDEX = PTRDIFF_MAX;
|
static const std::ptrdiff_t INVALID_INDEX;
|
||||||
|
|
||||||
// WARNING: 0-initialized.
|
// WARNING: 0-initialized.
|
||||||
std::ptrdiff_t value_;
|
std::ptrdiff_t value_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
const std::ptrdiff_t StrongIndexAlias<T>::INVALID_INDEX =
|
||||||
|
std::numeric_limits<std::ptrdiff_t>::max();
|
||||||
|
|
||||||
// Whether we are compiled with exception support.
|
// Whether we are compiled with exception support.
|
||||||
#ifndef YY_EXCEPTIONS
|
#ifndef YY_EXCEPTIONS
|
||||||
# if defined __GNUC__ && !defined __EXCEPTIONS
|
# if defined __GNUC__ && !defined __EXCEPTIONS
|
||||||
|
|||||||
Reference in New Issue
Block a user