21 Star 27 Fork 151

src-openEuler/gcc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0325-gcc-opts-common.cc-Fix-build-with-clang.patch 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
赵震宇 提交于 2024-12-11 15:00 +08:00 . sync patches from openeuler/gcc.
From 14457b169e1e4cb372d165de3bbdde391e8b817f Mon Sep 17 00:00:00 2001
From: YunQiang Su <yunqiang@isrc.iscas.ac.cn>
Date: Tue, 8 Oct 2024 18:04:01 +0800
Subject: [PATCH] gcc/opts-common.cc: Fix build with clang
1. For putenv ("AI_INFER_LEVEL=1"), clang complains that C++11 deprecates
convert string literal to char *, while putenv expcets "char *".
Let's use setenv, which expects "const char *".
2. Ditto for char *lan in handle_lto_option.
3. In `handle_machine_option`, there is a variable length array,
int64_t argv_hw[argc_hw]
clang complains about it, and in fact, argc_hw can be an const var.
---
gcc/opts-common.cc | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/gcc/opts-common.cc b/gcc/opts-common.cc
index 12c3f7299..33c696f3d 100644
--- a/gcc/opts-common.cc
+++ b/gcc/opts-common.cc
@@ -1053,7 +1053,7 @@ ai_infer_optimization (int argc, const char **argv,
dlclose (onnxruntime_lib_handle);
if (model_pred == 1)
- putenv ("AI_INFER_LEVEL=1");
+ setenv ("AI_INFER_LEVEL", "1", 1);
return model_pred;
}
@@ -1065,9 +1065,8 @@ handle_lto_option (unsigned int lang_mask,
struct cl_decoded_option *&opt_array)
{
int ret = 0;
- char *lan = "";
char *compiler = xstrdup (argv[0]);
- lan = strrchr (compiler, '/');
+ char *lan = strrchr (compiler, '/');
if (lan != NULL)
lan ++;
else
@@ -1125,7 +1124,7 @@ handle_machine_option (unsigned int lang_mask,
{
return ret;
}
- int argc_hw = 6;
+ const int argc_hw = 6;
int64_t argv_hw[argc_hw] = {
global_options.x_param_simultaneous_prefetches,
global_options.x_param_l1_cache_size,
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/gcc.git
git@gitee.com:src-openeuler/gcc.git
src-openeuler
gcc
gcc
master

搜索帮助