From: Nick Clifton <nickc@redhat.com>
To: binutils@sourceware.org
Subject: Commit: aarch64.em: Fix Clang compilation warning
Date: Thu, 05 Dec 2024 09:58:33 +0000 [thread overview]
Message-ID: <87y10u1meu.fsf@redhat.com> (raw)
Hi Guys,
I am checking in the patch below as an obvious fix for the compile
time warning messages generated by Clang when compiling the binutils
for AArch64 targets:
eaarch64cloudabi.c:378:50: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
378 | aarch64_parse_feature_report_option (const char *optarg,
/work/sources/binutils/upstream/current/ld/../include/getopt.h:35:14: note: previous declaration is here
35 | extern char *optarg;
eaarch64cloudabi.c:400:46: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
400 | aarch64_parse_bti_report_option (const char *optarg)
/work/sources/binutils/upstream/current/ld/../include/getopt.h:35:14: note: previous declaration is here
35 | extern char *optarg;
eaarch64cloudabi.c:413:46: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
413 | aarch64_parse_gcs_report_option (const char *optarg)
/work/sources/binutils/upstream/current/ld/../include/getopt.h:35:14: note: previous declaration is here
35 | extern char *optarg;
eaarch64cloudabi.c:426:39: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
426 | aarch64_parse_gcs_option (const char *optarg)
/work/sources/binutils/upstream/current/ld/../include/getopt.h:35:14: note: previous declaration is here
35 | extern char *optarg;
Cheers
Nick
diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
index 6dcb296c671..b4c9016a3e5 100644
--- a/ld/emultempl/aarch64elf.em
+++ b/ld/emultempl/aarch64elf.em
@@ -354,34 +354,34 @@ aarch64_elf_create_output_section_statements (void)
}
static bool
-aarch64_parse_feature_report_option (const char *optarg,
+aarch64_parse_feature_report_option (const char *_optarg,
const char *report_opt,
const size_t report_opt_len,
aarch64_feature_marking_report *level)
{
- if (strncmp (optarg, report_opt, report_opt_len) != 0)
+ if (strncmp (_optarg, report_opt, report_opt_len) != 0)
return false;
- if (strlen (optarg) == report_opt_len
- || strcmp (optarg + report_opt_len, "=warning") == 0)
+ if (strlen (_optarg) == report_opt_len
+ || strcmp (_optarg + report_opt_len, "=warning") == 0)
*level = MARKING_WARN;
- else if (strcmp (optarg + report_opt_len, "=none") == 0)
+ else if (strcmp (_optarg + report_opt_len, "=none") == 0)
*level = MARKING_NONE;
- else if (strcmp (optarg + report_opt_len, "=error") == 0)
+ else if (strcmp (_optarg + report_opt_len, "=error") == 0)
*level = MARKING_ERROR;
else
- einfo (_("%X%P: error: unrecognized value '-z %s'\n"), optarg);
+ einfo (_("%X%P: error: unrecognized value '-z %s'\n"), _optarg);
return true;
}
static bool
-aarch64_parse_bti_report_option (const char *optarg)
+aarch64_parse_bti_report_option (const char *_optarg)
{
#define BTI_REPORT "bti-report"
#define BTI_REPORT_LEN COMPILE_TIME_STRLEN (BTI_REPORT)
- return aarch64_parse_feature_report_option (optarg, BTI_REPORT,
+ return aarch64_parse_feature_report_option (_optarg, BTI_REPORT,
BTI_REPORT_LEN, &sw_protections.bti_report);
#undef BTI_REPORT
@@ -389,12 +389,12 @@ aarch64_parse_bti_report_option (const char *optarg)
}
static bool
-aarch64_parse_gcs_report_option (const char *optarg)
+aarch64_parse_gcs_report_option (const char *_optarg)
{
#define GCS_REPORT "gcs-report"
#define GCS_REPORT_LEN COMPILE_TIME_STRLEN (GCS_REPORT)
- return aarch64_parse_feature_report_option (optarg, GCS_REPORT,
+ return aarch64_parse_feature_report_option (_optarg, GCS_REPORT,
GCS_REPORT_LEN, &sw_protections.gcs_report);
#undef GCS_REPORT
@@ -402,22 +402,22 @@ aarch64_parse_gcs_report_option (const char *optarg)
}
static bool
-aarch64_parse_gcs_option (const char *optarg)
+aarch64_parse_gcs_option (const char *_optarg)
{
#define GCS "gcs"
#define GCS_LEN COMPILE_TIME_STRLEN (GCS)
- if (strncmp (optarg, GCS, GCS_LEN) != 0)
+ if (strncmp (_optarg, GCS, GCS_LEN) != 0)
return false;
- if (strcmp (optarg + GCS_LEN, "=always") == 0)
+ if (strcmp (_optarg + GCS_LEN, "=always") == 0)
sw_protections.gcs_type = GCS_ALWAYS;
- else if (strcmp (optarg + GCS_LEN, "=never") == 0)
+ else if (strcmp (_optarg + GCS_LEN, "=never") == 0)
sw_protections.gcs_type = GCS_NEVER;
- else if (strcmp (optarg + GCS_LEN, "=implicit") == 0)
+ else if (strcmp (_optarg + GCS_LEN, "=implicit") == 0)
sw_protections.gcs_type = GCS_IMPLICIT;
else
- einfo (_("%X%P: error: unrecognized value '-z %s'\n"), optarg);
+ einfo (_("%X%P: error: unrecognized value '-z %s'\n"), _optarg);
return true;
next reply other threads:[~2024-12-05 9:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 9:58 Nick Clifton [this message]
2024-12-09 8:59 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y10u1meu.fsf@redhat.com \
--to=nickc@redhat.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).