* Analyzer failure due to missing header
@ 2023-08-30 9:10 FX Coudert
2023-08-30 9:14 ` Jakub Jelinek
2023-08-30 21:24 ` FX Coudert
0 siblings, 2 replies; 4+ messages in thread
From: FX Coudert @ 2023-08-30 9:10 UTC (permalink / raw)
To: gcc; +Cc: dmalcolm
Hi David,
I’m seeing the following failures on building GCC with Apple’s clang:
> /Users/fx/devel/gcc/gcc-repo-write/gcc/analyzer/region-model.cc:3426:16: error: unexpected type name 'byte_size_t': expected expression
> std::max<byte_size_t> (bytes.m_size_in_bytes,
> ^
> /Users/fx/devel/gcc/gcc-repo-write/gcc/analyzer/region-model.cc:3426:12: error: no member named 'max' in namespace 'std'; did you mean 'fmax'?
> std::max<byte_size_t> (bytes.m_size_in_bytes,
> ~~~~~^~~
> fmax
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:420:9: note: 'fmax' declared here
> using ::fmax _LIBCPP_USING_IF_EXISTS;
> ^
> /Users/fx/devel/gcc/gcc-repo-write/gcc/analyzer/region-model.cc:3450:18: error: expected '(' for function-style cast or type construction
> = std::min<HOST_WIDE_INT> ((TREE_STRING_LENGTH (string_cst)
> ^~~~~~~~~~~~~
> /Users/fx/devel/gcc/gcc-repo-write/gcc/hwint.h:59:31: note: expanded from macro 'HOST_WIDE_INT'
> # define HOST_WIDE_INT long long
> ~~~~ ^
> /Users/fx/devel/gcc/gcc-repo-write/gcc/analyzer/region-model.cc:3450:14: error: no member named 'min' in namespace 'std'
> = std::min<HOST_WIDE_INT> ((TREE_STRING_LENGTH (string_cst)
> ~~~~~^
std::max and std::min, introduced by d99d73c77d1e and 2bad0eeb5573, are not available because <algorithm> is not included. The following patch fixes the build for me:
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 4f31a6dcf0f..1ca8c8839bf 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#define INCLUDE_MEMORY
+#define INCLUDE_ALGORITHM
#include "system.h"
#include "coretypes.h"
#include "make-unique.h”
Could you check it is what you intended, and push it?
Thanks,
FX
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Analyzer failure due to missing header
2023-08-30 9:10 Analyzer failure due to missing header FX Coudert
@ 2023-08-30 9:14 ` Jakub Jelinek
2023-08-30 21:24 ` FX Coudert
1 sibling, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2023-08-30 9:14 UTC (permalink / raw)
To: FX Coudert, David Malcolm; +Cc: gcc
On Wed, Aug 30, 2023 at 11:10:57AM +0200, FX Coudert via Gcc wrote:
> std::max and std::min, introduced by d99d73c77d1e and 2bad0eeb5573, are not available because <algorithm> is not included. The following patch fixes the build for me:
>
> diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
> index 4f31a6dcf0f..1ca8c8839bf 100644
> --- a/gcc/analyzer/region-model.cc
> +++ b/gcc/analyzer/region-model.cc
> @@ -20,6 +20,7 @@ along with GCC; see the file COPYING3. If not see
> #include "config.h"
> #define INCLUDE_MEMORY
> +#define INCLUDE_ALGORITHM
> #include "system.h"
> #include "coretypes.h"
> #include "make-unique.h”
>
>
> Could you check it is what you intended, and push it?
Note, when using libstdc++ headers, <algorithm> isn't needed,
because <memory> includes bits/stl_algobase.h which defines std::min/max.
Another possibility is of course use MIN/MAX macros instead of std::min/max.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Analyzer failure due to missing header
2023-08-30 9:10 Analyzer failure due to missing header FX Coudert
2023-08-30 9:14 ` Jakub Jelinek
@ 2023-08-30 21:24 ` FX Coudert
2023-08-30 21:47 ` David Malcolm
1 sibling, 1 reply; 4+ messages in thread
From: FX Coudert @ 2023-08-30 21:24 UTC (permalink / raw)
To: GCC Patches; +Cc: dmalcolm, gcc
[-- Attachment #1: Type: text/plain, Size: 283 bytes --]
> std::max and std::min, introduced by d99d73c77d1e and 2bad0eeb5573, are not available because <algorithm> is not included.
I originally thought this was only seen in cross-compilers, but it actually broke bootstrap on darwin.
Attached patch restores it, OK to commit?
FX
[-- Attachment #2: 0001-Analyzer-include-algorithm-header.patch --]
[-- Type: application/octet-stream, Size: 810 bytes --]
From 4e1e8752549cde215c4afaad19194003aaa54f7f Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Wed, 30 Aug 2023 23:21:58 +0200
Subject: [PATCH] Analyzer: include algorithm header
gcc/analyzer/ChangeLog:
* region-model.cc: Define INCLUDE_ALGORITHM.
---
gcc/analyzer/region-model.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 4f31a6dcf0f..1ca8c8839bf 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#define INCLUDE_MEMORY
+#define INCLUDE_ALGORITHM
#include "system.h"
#include "coretypes.h"
#include "make-unique.h"
--
2.39.2 (Apple Git-143)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Analyzer failure due to missing header
2023-08-30 21:24 ` FX Coudert
@ 2023-08-30 21:47 ` David Malcolm
0 siblings, 0 replies; 4+ messages in thread
From: David Malcolm @ 2023-08-30 21:47 UTC (permalink / raw)
To: FX Coudert, GCC Patches; +Cc: gcc
On Wed, 2023-08-30 at 23:24 +0200, FX Coudert wrote:
> > std::max and std::min, introduced by d99d73c77d1e and 2bad0eeb5573,
> > are not available because <algorithm> is not included.
>
> I originally thought this was only seen in cross-compilers, but it
> actually broke bootstrap on darwin.
> Attached patch restores it, OK to commit?
LGTM
Thanks
Dave
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-30 21:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30 9:10 Analyzer failure due to missing header FX Coudert
2023-08-30 9:14 ` Jakub Jelinek
2023-08-30 21:24 ` FX Coudert
2023-08-30 21:47 ` David Malcolm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).