>From 0759f79241d147233b62e85de2139734949b903b Mon Sep 17 00:00:00 2001
From: Paul Eggert
Date: Thu, 17 Oct 2019 12:24:33 -0700
Subject: [PATCH 11/11] c++: port to Sun C++ 5.12
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 ; no longer needed.
---
data/skeletons/location.cc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/data/skeletons/location.cc b/data/skeletons/location.cc
index 8a330b92..78af3698 100644
--- a/data/skeletons/location.cc
+++ b/data/skeletons/location.cc
@@ -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 // std::max
# include
# include
--
2.21.0