mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
c++: port to Sun C++ 5.12
The documentation for Oracle Solaris Studio 12.3 (Sun C++ 5.12 2011/11/16) says it supports C++03. This compiler rejects the location.cc use of std::max for some reason; I don’t know why since I don’t use C++ as a rule. The simplest workaround is to open-code ‘max’. * data/skeletons/location.cc (add_): Do max by hand rather than relying on std::max. Don’t include <algorithm.h>; no longer needed.
This commit is contained in:
@@ -113,7 +113,7 @@ m4_define([b4_location_define],
|
||||
/// Compute max (min, lhs+rhs).
|
||||
static int add_ (int lhs, int rhs, int min)
|
||||
{
|
||||
return std::max (min, lhs + rhs);
|
||||
return lhs + rhs < min ? min : lhs + rhs;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -345,7 +345,6 @@ m4_ifdef([b4_location_file], [[
|
||||
|
||||
]b4_cpp_guard_open([b4_location_path])[
|
||||
|
||||
# include <algorithm> // std::max
|
||||
# include <iostream>
|
||||
# include <string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user