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:
Paul Eggert
2019-10-17 12:24:33 -07:00
parent 693e69f289
commit 54c5d5d1b4

View File

@@ -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>