Ternary operator formatting fixes
While working on PR117028 C2Y changes, I've noticed weird ternary operator formatting (operand1 ? operand2: operand3). The usual formatting is operand1 ? operand2 : operand3 where we have around 18000+ cases of that (counting only what fits on one line) and indent -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 -ndj \ -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob documented in https://www.gnu.org/prep/standards/html_node/Formatting.html#Formatting does the same. Some code was even trying to save space as much as possible and used operand1?operand2:operand3 or operand1 ? operand2:operand3 Today I've grepped for such cases (the grep was '?.*[^ ]:' and I had to skim through various false positives with that where the : matched e.g. stuff inside of strings, or *.md pattern macros or :: scope) and the following patch is a fix for what I found. 2024-10-16 Jakub Jelinek <jakub@redhat.com> gcc/ * attribs.cc (lookup_scoped_attribute_spec): ?: operator formatting fixes. * basic-block.h (FOR_BB_INSNS_SAFE): Likewise. * cfgcleanup.cc (outgoing_edges_match): Likewise. * cgraph.cc (cgraph_node::dump): Likewise. * config/arc/arc.cc (gen_acc1, gen_acc2): Likewise. * config/arc/arc.h (CLASS_MAX_NREGS, CONSTANT_ADDRESS_P): Likewise. * config/arm/arm.cc (arm_print_operand): Likewise. * config/cris/cris.md (*b<rnzcond:code><mode>): Likewise. * config/darwin.cc (darwin_asm_declare_object_name, darwin_emit_common): Likewise. * config/darwin-driver.cc (darwin_driver_init): Likewise. * config/epiphany/epiphany.md (call, sibcall, call_value, sibcall_value): Likewise. * config/i386/i386.cc (gen_push2): Likewise. * config/i386/i386.h (ix86_cur_cost): Likewise. * config/i386/openbsdelf.h (FUNCTION_PROFILER): Likewise. * config/loongarch/loongarch-c.cc (loongarch_cpu_cpp_builtins): Likewise. * config/loongarch/loongarch-cpu.cc (fill_native_cpu_config): Likewise. * config/riscv/riscv.cc (riscv_union_memmodels): Likewise. * config/riscv/zc.md (*mva01s<X:mode>, *mvsa01<X:mode>): Likewise. * config/rs6000/mmintrin.h (_mm_cmpeq_pi8, _mm_cmpgt_pi8, _mm_cmpeq_pi16, _mm_cmpgt_pi16, _mm_cmpeq_pi32, _mm_cmpgt_pi32): Likewise. * config/v850/predicates.md (pattern_is_ok_for_prologue): Likewise. * config/xtensa/constraints.md (d, C, W): Likewise. * coverage.cc (coverage_begin_function, build_init_ctor, build_gcov_exit_decl): Likewise. * df-problems.cc (df_create_unused_note): Likewise. * diagnostic.cc (diagnostic_set_caret_max_width): Likewise. * diagnostic-path.cc (path_summary::path_summary): Likewise. * expr.cc (expand_expr_divmod): Likewise. * gcov.cc (format_gcov): Likewise. * gcov-dump.cc (dump_gcov_file): Likewise. * genmatch.cc (main): Likewise. * incpath.cc (remove_duplicates, register_include_chains): Likewise. * ipa-devirt.cc (dump_odr_type): Likewise. * ipa-icf.cc (sem_item_optimizer::merge_classes): Likewise. * ipa-inline.cc (inline_small_functions): Likewise. * ipa-polymorphic-call.cc (ipa_polymorphic_call_context::dump): Likewise. * ipa-sra.cc (create_parameter_descriptors): Likewise. * ipa-utils.cc (find_always_executed_bbs): Likewise. * predict.cc (predict_loops): Likewise. * selftest.cc (read_file): Likewise. * sreal.h (SREAL_SIGN, SREAL_ABS): Likewise. * tree-dump.cc (dequeue_and_dump): Likewise. * tree-ssa-ccp.cc (bit_value_binop): Likewise. gcc/c-family/ * c-opts.cc (c_common_init_options, c_common_handle_option, c_common_finish, set_std_c89, set_std_c99, set_std_c11, set_std_c17, set_std_c23, set_std_cxx98, set_std_cxx11, set_std_cxx14, set_std_cxx17, set_std_cxx20, set_std_cxx23, set_std_cxx26): ?: operator formatting fixes. gcc/cp/ * search.cc (lookup_member): ?: operator formatting fixes. * typeck.cc (cp_build_modify_expr): Likewise. libcpp/ * expr.cc (interpret_float_suffix): ?: operator formatting fixes.
Showing
- gcc/attribs.cc 1 addition, 1 deletiongcc/attribs.cc
- gcc/basic-block.h 1 addition, 1 deletiongcc/basic-block.h
- gcc/c-family/c-opts.cc 16 additions, 16 deletionsgcc/c-family/c-opts.cc
- gcc/cfgcleanup.cc 2 additions, 2 deletionsgcc/cfgcleanup.cc
- gcc/cgraph.cc 1 addition, 1 deletiongcc/cgraph.cc
- gcc/config/arc/arc.cc 2 additions, 2 deletionsgcc/config/arc/arc.cc
- gcc/config/arc/arc.h 5 additions, 5 deletionsgcc/config/arc/arc.h
- gcc/config/arm/arm.cc 6 additions, 6 deletionsgcc/config/arm/arm.cc
- gcc/config/cris/cris.md 1 addition, 1 deletiongcc/config/cris/cris.md
- gcc/config/darwin-driver.cc 2 additions, 2 deletionsgcc/config/darwin-driver.cc
- gcc/config/darwin.cc 2 additions, 2 deletionsgcc/config/darwin.cc
- gcc/config/epiphany/epiphany.md 8 additions, 8 deletionsgcc/config/epiphany/epiphany.md
- gcc/config/i386/i386.cc 2 additions, 2 deletionsgcc/config/i386/i386.cc
- gcc/config/i386/i386.h 1 addition, 1 deletiongcc/config/i386/i386.h
- gcc/config/i386/openbsdelf.h 1 addition, 1 deletiongcc/config/i386/openbsdelf.h
- gcc/config/loongarch/loongarch-c.cc 1 addition, 1 deletiongcc/config/loongarch/loongarch-c.cc
- gcc/config/loongarch/loongarch-cpu.cc 2 additions, 2 deletionsgcc/config/loongarch/loongarch-cpu.cc
- gcc/config/riscv/riscv.cc 2 additions, 2 deletionsgcc/config/riscv/riscv.cc
- gcc/config/riscv/zc.md 2 additions, 2 deletionsgcc/config/riscv/zc.md
- gcc/config/rs6000/mmintrin.h 28 additions, 28 deletionsgcc/config/rs6000/mmintrin.h
Loading
Please register or sign in to comment