public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V/gas: fix build with certain gcc versions
@ 2022-10-28 10:06 Jan Beulich
  2022-10-28 10:33 ` Nelson Chu
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2022-10-28 10:06 UTC (permalink / raw)
  To: Binutils; +Cc: Palmer Dabbelt, Andrew Waterman, Jim Wilson, Nelson Chu

Some versions of gcc warn by default about shadowed outer-scope
declarations. This affects frag_align_code, which is declared in
frags.h. Rename the offending function parameter. While there also
switch to using true/false at the function call sites.

--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -549,7 +549,7 @@ make_mapping_symbol (enum riscv_seg_msta
 void
 riscv_mapping_state (enum riscv_seg_mstate to_state,
 		     int max_chars,
-		     bool frag_align_code)
+		     bool fr_align_code)
 {
   enum riscv_seg_mstate from_state =
 	seg_info (now_seg)->tc_segment_info_data.map_state;
@@ -574,7 +574,7 @@ riscv_mapping_state (enum riscv_seg_msta
     }
   else if (seg_arch_symbol != 0
 	   && to_state == MAP_INSN
-	   && !frag_align_code
+	   && !fr_align_code
 	   && strcmp (riscv_rps_as.subset_list->arch_str,
 		      S_GET_NAME (seg_arch_symbol) + 2) != 0)
     {
@@ -3540,7 +3540,7 @@ md_assemble (char *str)
        return;
     }
 
-  riscv_mapping_state (MAP_INSN, 0, 0/* frag_align_code */);
+  riscv_mapping_state (MAP_INSN, 0, false/* fr_align_code */);
 
   const struct riscv_ip_error error = riscv_ip (str, &insn, &imm_expr,
 						&imm_reloc, op_hash);
@@ -4219,7 +4219,7 @@ riscv_frag_align_code (int n)
   fix_new_exp (frag_now, nops - frag_now->fr_literal, 0,
 	       &ex, false, BFD_RELOC_RISCV_ALIGN);
 
-  riscv_mapping_state (MAP_INSN, worst_case_bytes, 1/* frag_align_code */);
+  riscv_mapping_state (MAP_INSN, worst_case_bytes, true/* fr_align_code */);
 
   /* We need to start a new frag after the alignment which may be removed by
      the linker, to prevent the assembler from computing static offsets.
@@ -4293,10 +4293,10 @@ riscv_init_frag (fragS * fragP, int max_
     case rs_fill:
     case rs_align:
     case rs_align_test:
-      riscv_mapping_state (MAP_DATA, max_chars, 0/* frag_align_code */);
+      riscv_mapping_state (MAP_DATA, max_chars, false/* fr_align_code */);
       break;
     case rs_align_code:
-      riscv_mapping_state (MAP_INSN, max_chars, 1/* frag_align_code */);
+      riscv_mapping_state (MAP_INSN, max_chars, true/* fr_align_code */);
       break;
     default:
       break;
@@ -4570,7 +4570,7 @@ s_riscv_insn (int x ATTRIBUTE_UNUSED)
   save_c = *input_line_pointer;
   *input_line_pointer = '\0';
 
-  riscv_mapping_state (MAP_INSN, 0, 0/* frag_align_code */);
+  riscv_mapping_state (MAP_INSN, 0, false/* fr_align_code */);
 
   struct riscv_ip_error error = riscv_ip (str, &insn, &imm_expr,
 				&imm_reloc, insn_type_hash);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] RISC-V/gas: fix build with certain gcc versions
  2022-10-28 10:06 [PATCH] RISC-V/gas: fix build with certain gcc versions Jan Beulich
@ 2022-10-28 10:33 ` Nelson Chu
  0 siblings, 0 replies; 2+ messages in thread
From: Nelson Chu @ 2022-10-28 10:33 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Binutils, Palmer Dabbelt, Andrew Waterman, Jim Wilson

Thanks for fixing this!  Please commit.

Thanks
Nelson

On Fri, Oct 28, 2022 at 6:06 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> Some versions of gcc warn by default about shadowed outer-scope
> declarations. This affects frag_align_code, which is declared in
> frags.h. Rename the offending function parameter. While there also
> switch to using true/false at the function call sites.
>
> --- a/gas/config/tc-riscv.c
> +++ b/gas/config/tc-riscv.c
> @@ -549,7 +549,7 @@ make_mapping_symbol (enum riscv_seg_msta
>  void
>  riscv_mapping_state (enum riscv_seg_mstate to_state,
>                      int max_chars,
> -                    bool frag_align_code)
> +                    bool fr_align_code)
>  {
>    enum riscv_seg_mstate from_state =
>         seg_info (now_seg)->tc_segment_info_data.map_state;
> @@ -574,7 +574,7 @@ riscv_mapping_state (enum riscv_seg_msta
>      }
>    else if (seg_arch_symbol != 0
>            && to_state == MAP_INSN
> -          && !frag_align_code
> +          && !fr_align_code
>            && strcmp (riscv_rps_as.subset_list->arch_str,
>                       S_GET_NAME (seg_arch_symbol) + 2) != 0)
>      {
> @@ -3540,7 +3540,7 @@ md_assemble (char *str)
>         return;
>      }
>
> -  riscv_mapping_state (MAP_INSN, 0, 0/* frag_align_code */);
> +  riscv_mapping_state (MAP_INSN, 0, false/* fr_align_code */);
>
>    const struct riscv_ip_error error = riscv_ip (str, &insn, &imm_expr,
>                                                 &imm_reloc, op_hash);
> @@ -4219,7 +4219,7 @@ riscv_frag_align_code (int n)
>    fix_new_exp (frag_now, nops - frag_now->fr_literal, 0,
>                &ex, false, BFD_RELOC_RISCV_ALIGN);
>
> -  riscv_mapping_state (MAP_INSN, worst_case_bytes, 1/* frag_align_code */);
> +  riscv_mapping_state (MAP_INSN, worst_case_bytes, true/* fr_align_code */);
>
>    /* We need to start a new frag after the alignment which may be removed by
>       the linker, to prevent the assembler from computing static offsets.
> @@ -4293,10 +4293,10 @@ riscv_init_frag (fragS * fragP, int max_
>      case rs_fill:
>      case rs_align:
>      case rs_align_test:
> -      riscv_mapping_state (MAP_DATA, max_chars, 0/* frag_align_code */);
> +      riscv_mapping_state (MAP_DATA, max_chars, false/* fr_align_code */);
>        break;
>      case rs_align_code:
> -      riscv_mapping_state (MAP_INSN, max_chars, 1/* frag_align_code */);
> +      riscv_mapping_state (MAP_INSN, max_chars, true/* fr_align_code */);
>        break;
>      default:
>        break;
> @@ -4570,7 +4570,7 @@ s_riscv_insn (int x ATTRIBUTE_UNUSED)
>    save_c = *input_line_pointer;
>    *input_line_pointer = '\0';
>
> -  riscv_mapping_state (MAP_INSN, 0, 0/* frag_align_code */);
> +  riscv_mapping_state (MAP_INSN, 0, false/* fr_align_code */);
>
>    struct riscv_ip_error error = riscv_ip (str, &insn, &imm_expr,
>                                 &imm_reloc, insn_type_hash);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-28 10:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 10:06 [PATCH] RISC-V/gas: fix build with certain gcc versions Jan Beulich
2022-10-28 10:33 ` Nelson Chu

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).