From: Alan Modra Date: Mon, 6 May 2019 11:53:45 +0000 (+0930) Subject: Tidy use_complex_relocs_for X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f1309c8f7530b31ecc73c55e86572ff72256947;p=binutils-gdb.git Tidy use_complex_relocs_for Since I was looking at this I decided to fix the formatting, and used an old C switch statements trick to factor out common code. * symbols.c (use_complex_relocs_for): Formatting. Factor out X_add_symbol tests. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index e83a893b4e0..fc8ea0b75f5 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2019-05-07 Alan Modra + + * symbols.c (use_complex_relocs_for): Formatting. Factor out + X_add_symbol tests. + 2019-05-06 Andrew Bennett Faraz Shahbazker diff --git a/gas/symbols.c b/gas/symbols.c index 10d7b1c273e..918028f8750 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -1097,19 +1097,6 @@ use_complex_relocs_for (symbolS * symp) case O_constant: return 0; - case O_symbol: - case O_symbol_rva: - case O_uminus: - case O_bit_not: - case O_logical_not: - if ( (S_IS_COMMON (symp->sy_value.X_add_symbol) - || S_IS_LOCAL (symp->sy_value.X_add_symbol)) - && - (S_IS_DEFINED (symp->sy_value.X_add_symbol) - && S_GET_SEGMENT (symp->sy_value.X_add_symbol) != expr_section)) - return 0; - break; - case O_multiply: case O_divide: case O_modulus: @@ -1129,18 +1116,22 @@ use_complex_relocs_for (symbolS * symp) case O_gt: case O_logical_and: case O_logical_or: - - if ( (S_IS_COMMON (symp->sy_value.X_add_symbol) - || S_IS_LOCAL (symp->sy_value.X_add_symbol)) - && - (S_IS_COMMON (symp->sy_value.X_op_symbol) + if ((S_IS_COMMON (symp->sy_value.X_op_symbol) || S_IS_LOCAL (symp->sy_value.X_op_symbol)) - - && S_IS_DEFINED (symp->sy_value.X_add_symbol) && S_IS_DEFINED (symp->sy_value.X_op_symbol) - && S_GET_SEGMENT (symp->sy_value.X_add_symbol) != expr_section && S_GET_SEGMENT (symp->sy_value.X_op_symbol) != expr_section) - return 0; + { + case O_symbol: + case O_symbol_rva: + case O_uminus: + case O_bit_not: + case O_logical_not: + if ((S_IS_COMMON (symp->sy_value.X_add_symbol) + || S_IS_LOCAL (symp->sy_value.X_add_symbol)) + && S_IS_DEFINED (symp->sy_value.X_add_symbol) + && S_GET_SEGMENT (symp->sy_value.X_add_symbol) != expr_section) + return 0; + } break; default: