From e48a65d3b3fcbcf6059df247d9c87a9a19b35861 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Wed, 16 Oct 2024 14:44:32 +0200
Subject: [PATCH] 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.
---
 gcc/attribs.cc                        |  2 +-
 gcc/basic-block.h                     |  2 +-
 gcc/c-family/c-opts.cc                | 32 +++++++--------
 gcc/cfgcleanup.cc                     |  4 +-
 gcc/cgraph.cc                         |  2 +-
 gcc/config/arc/arc.cc                 |  4 +-
 gcc/config/arc/arc.h                  | 10 ++---
 gcc/config/arm/arm.cc                 | 12 +++---
 gcc/config/cris/cris.md               |  2 +-
 gcc/config/darwin-driver.cc           |  4 +-
 gcc/config/darwin.cc                  |  4 +-
 gcc/config/epiphany/epiphany.md       | 16 ++++----
 gcc/config/i386/i386.cc               |  4 +-
 gcc/config/i386/i386.h                |  2 +-
 gcc/config/i386/openbsdelf.h          |  2 +-
 gcc/config/loongarch/loongarch-c.cc   |  2 +-
 gcc/config/loongarch/loongarch-cpu.cc |  4 +-
 gcc/config/riscv/riscv.cc             |  4 +-
 gcc/config/riscv/zc.md                |  4 +-
 gcc/config/rs6000/mmintrin.h          | 56 +++++++++++++--------------
 gcc/config/v850/predicates.md         |  2 +-
 gcc/config/xtensa/constraints.md      |  6 +--
 gcc/coverage.cc                       | 10 ++---
 gcc/cp/search.cc                      |  2 +-
 gcc/cp/typeck.cc                      |  2 +-
 gcc/df-problems.cc                    |  2 +-
 gcc/diagnostic-path.cc                |  2 +-
 gcc/diagnostic.cc                     |  2 +-
 gcc/expr.cc                           |  2 +-
 gcc/gcov-dump.cc                      |  4 +-
 gcc/gcov.cc                           |  2 +-
 gcc/genmatch.cc                       |  4 +-
 gcc/incpath.cc                        |  4 +-
 gcc/ipa-devirt.cc                     |  4 +-
 gcc/ipa-icf.cc                        |  2 +-
 gcc/ipa-inline.cc                     |  5 ++-
 gcc/ipa-polymorphic-call.cc           |  2 +-
 gcc/ipa-sra.cc                        |  2 +-
 gcc/ipa-utils.cc                      | 17 +++++---
 gcc/predict.cc                        |  2 +-
 gcc/selftest.cc                       |  2 +-
 gcc/sreal.h                           |  4 +-
 gcc/tree-dump.cc                      |  9 +++--
 gcc/tree-ssa-ccp.cc                   |  2 +-
 libcpp/expr.cc                        |  4 +-
 45 files changed, 140 insertions(+), 131 deletions(-)

diff --git a/gcc/attribs.cc b/gcc/attribs.cc
index 9fb564bd55dd..0be7b83b2642 100644
--- a/gcc/attribs.cc
+++ b/gcc/attribs.cc
@@ -381,7 +381,7 @@ lookup_scoped_attribute_spec (const_tree ns, const_tree name)
   struct substring attr;
   scoped_attributes *attrs;
 
-  const char *ns_str = (ns != NULL_TREE) ? IDENTIFIER_POINTER (ns): NULL;
+  const char *ns_str = (ns != NULL_TREE) ? IDENTIFIER_POINTER (ns) : NULL;
 
   attrs = find_attribute_namespace (ns_str);
 
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 5d3e629229e3..ba68660ebeef 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -224,7 +224,7 @@ enum cfg_bb_flags
 /* For iterating over insns in basic block when we might remove the
    current insn.  */
 #define FOR_BB_INSNS_SAFE(BB, INSN, CURR)			\
-  for ((INSN) = BB_HEAD (BB), (CURR) = (INSN) ? NEXT_INSN ((INSN)): NULL;	\
+  for ((INSN) = BB_HEAD (BB), (CURR) = (INSN) ? NEXT_INSN ((INSN)) : NULL;	\
        (INSN) && (INSN) != NEXT_INSN (BB_END (BB));	\
        (INSN) = (CURR), (CURR) = (INSN) ? NEXT_INSN ((INSN)) : NULL)
 
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index 510e0870140e..21ed7c73d89a 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -242,7 +242,7 @@ c_common_init_options (unsigned int decoded_options_count,
   g_string_concat_db
     = new (ggc_alloc <string_concat_db> ()) string_concat_db ();
 
-  parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX: CLK_GNUC89,
+  parse_in = cpp_create_reader (c_dialect_cxx () ? CLK_GNUCXX : CLK_GNUC89,
 				ident_hash, line_table, ident_hash_extra);
   cb = cpp_get_callbacks (parse_in);
   cb->diagnostic = c_cpp_diagnostic;
@@ -358,13 +358,13 @@ c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
 	 preprocessed output, but still do -dM etc. as software
 	 depends on this.  Preprocessed output does occur if -MD, -MMD
 	 or environment var dependency generation is used.  */
-      cpp_opts->deps.style = (code == OPT_M ? DEPS_SYSTEM: DEPS_USER);
+      cpp_opts->deps.style = (code == OPT_M ? DEPS_SYSTEM : DEPS_USER);
       flag_no_output = 1;
       break;
 
     case OPT_MD:
     case OPT_MMD:
-      cpp_opts->deps.style = (code == OPT_MD ? DEPS_SYSTEM: DEPS_USER);
+      cpp_opts->deps.style = (code == OPT_MD ? DEPS_SYSTEM : DEPS_USER);
       cpp_opts->deps.need_preprocessor_output = true;
       deps_file = arg;
       break;
@@ -1389,7 +1389,7 @@ c_common_finish (void)
 	deps_stream = stdout;
       else
 	{
-	  deps_stream = fopen (deps_file, deps_append ? "a": "w");
+	  deps_stream = fopen (deps_file, deps_append ? "a" : "w");
 	  if (!deps_stream)
 	    fatal_error (input_location, "opening dependency file %s: %m",
 			 deps_file);
@@ -1811,7 +1811,7 @@ cb_dir_change (cpp_reader * ARG_UNUSED (pfile), const char *dir)
 static void
 set_std_c89 (int c94, int iso)
 {
-  cpp_set_lang (parse_in, c94 ? CLK_STDC94: iso ? CLK_STDC89: CLK_GNUC89);
+  cpp_set_lang (parse_in, c94 ? CLK_STDC94 : iso ? CLK_STDC89 : CLK_GNUC89);
   flag_iso = iso;
   flag_no_asm = iso;
   flag_no_gnu_keywords = iso;
@@ -1828,7 +1828,7 @@ set_std_c89 (int c94, int iso)
 static void
 set_std_c99 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_STDC99: CLK_GNUC99);
+  cpp_set_lang (parse_in, iso ? CLK_STDC99 : CLK_GNUC99);
   flag_no_asm = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
@@ -1844,7 +1844,7 @@ set_std_c99 (int iso)
 static void
 set_std_c11 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_STDC11: CLK_GNUC11);
+  cpp_set_lang (parse_in, iso ? CLK_STDC11 : CLK_GNUC11);
   flag_no_asm = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
@@ -1860,7 +1860,7 @@ set_std_c11 (int iso)
 static void
 set_std_c17 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_STDC17: CLK_GNUC17);
+  cpp_set_lang (parse_in, iso ? CLK_STDC17 : CLK_GNUC17);
   flag_no_asm = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
@@ -1876,7 +1876,7 @@ set_std_c17 (int iso)
 static void
 set_std_c23 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_STDC23: CLK_GNUC23);
+  cpp_set_lang (parse_in, iso ? CLK_STDC23 : CLK_GNUC23);
   flag_no_asm = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
@@ -1909,7 +1909,7 @@ set_std_c2y (int iso)
 static void
 set_std_cxx98 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_CXX98: CLK_GNUCXX);
+  cpp_set_lang (parse_in, iso ? CLK_CXX98 : CLK_GNUCXX);
   flag_no_gnu_keywords = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
@@ -1923,7 +1923,7 @@ set_std_cxx98 (int iso)
 static void
 set_std_cxx11 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_CXX11: CLK_GNUCXX11);
+  cpp_set_lang (parse_in, iso ? CLK_CXX11 : CLK_GNUCXX11);
   flag_no_gnu_keywords = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
@@ -1938,7 +1938,7 @@ set_std_cxx11 (int iso)
 static void
 set_std_cxx14 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_CXX14: CLK_GNUCXX14);
+  cpp_set_lang (parse_in, iso ? CLK_CXX14 : CLK_GNUCXX14);
   flag_no_gnu_keywords = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
@@ -1953,7 +1953,7 @@ set_std_cxx14 (int iso)
 static void
 set_std_cxx17 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_CXX17: CLK_GNUCXX17);
+  cpp_set_lang (parse_in, iso ? CLK_CXX17 : CLK_GNUCXX17);
   flag_no_gnu_keywords = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
@@ -1969,7 +1969,7 @@ set_std_cxx17 (int iso)
 static void
 set_std_cxx20 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_CXX20: CLK_GNUCXX20);
+  cpp_set_lang (parse_in, iso ? CLK_CXX20 : CLK_GNUCXX20);
   flag_no_gnu_keywords = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
@@ -1987,7 +1987,7 @@ set_std_cxx20 (int iso)
 static void
 set_std_cxx23 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_CXX23: CLK_GNUCXX23);
+  cpp_set_lang (parse_in, iso ? CLK_CXX23 : CLK_GNUCXX23);
   flag_no_gnu_keywords = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
@@ -2005,7 +2005,7 @@ set_std_cxx23 (int iso)
 static void
 set_std_cxx26 (int iso)
 {
-  cpp_set_lang (parse_in, iso ? CLK_CXX26: CLK_GNUCXX26);
+  cpp_set_lang (parse_in, iso ? CLK_CXX26 : CLK_GNUCXX26);
   flag_no_gnu_keywords = iso;
   flag_no_nonansi_builtin = iso;
   flag_iso = iso;
diff --git a/gcc/cfgcleanup.cc b/gcc/cfgcleanup.cc
index a3b2e93fa510..004db1063f6c 100644
--- a/gcc/cfgcleanup.cc
+++ b/gcc/cfgcleanup.cc
@@ -1862,9 +1862,9 @@ outgoing_edges_match (int mode, basic_block bb1, basic_block bb2)
   if (fallthru1)
     {
       basic_block d1 = (FORWARDER_BLOCK_P (fallthru1->dest)
-			? single_succ (fallthru1->dest): fallthru1->dest);
+			? single_succ (fallthru1->dest) : fallthru1->dest);
       basic_block d2 = (FORWARDER_BLOCK_P (fallthru2->dest)
-			? single_succ (fallthru2->dest): fallthru2->dest);
+			? single_succ (fallthru2->dest) : fallthru2->dest);
 
       if (d1 != d2)
 	return false;
diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 39a3adbc7c35..b5d096d530c0 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -2309,7 +2309,7 @@ cgraph_node::dump (FILE *f)
 	  if (edge->indirect_info->agg_contents)
 	   fprintf (f, "loaded from %s %s at offset %i ",
 		    edge->indirect_info->member_ptr ? "member ptr" : "aggregate",
-		    edge->indirect_info->by_ref ? "passed by reference":"",
+		    edge->indirect_info->by_ref ? "passed by reference" : "",
 		    (int)edge->indirect_info->offset);
 	  if (edge->indirect_info->vptr_changed)
 	    fprintf (f, "(vptr maybe changed) ");
diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc
index a225adeff573..ba7bde1de443 100644
--- a/gcc/config/arc/arc.cc
+++ b/gcc/config/arc/arc.cc
@@ -9674,7 +9674,7 @@ arc_delegitimize_address (rtx orig_x)
 rtx
 gen_acc1 (void)
 {
-  return gen_rtx_REG (SImode, TARGET_BIG_ENDIAN ? 56: 57);
+  return gen_rtx_REG (SImode, TARGET_BIG_ENDIAN ? 56 : 57);
 }
 
 /* Return a REG rtx for acc2.  N.B. the gcc-internal representation may
@@ -9684,7 +9684,7 @@ gen_acc1 (void)
 rtx
 gen_acc2 (void)
 {
-  return gen_rtx_REG (SImode, TARGET_BIG_ENDIAN ? 57: 56);
+  return gen_rtx_REG (SImode, TARGET_BIG_ENDIAN ? 57 : 56);
 }
 
 /* When estimating sizes during arc_reorg, when optimizing for speed, there
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 4cadef7a2b2b..1d3bc375b163 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -608,8 +608,8 @@ extern enum reg_class arc_regno_reg_class[];
    needed to represent mode MODE in a register of class CLASS.  */
 
 #define CLASS_MAX_NREGS(CLASS, MODE) \
-(( GET_MODE_SIZE (MODE) == 16 && CLASS == SIMD_VR_REGS) ? 1: \
-((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
+((GET_MODE_SIZE (MODE) == 16 && CLASS == SIMD_VR_REGS) ? 1 \
+ : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
 
 #define SMALL_INT(X) ((unsigned) ((X) + 0x100) < 0x200)
 #define SMALL_INT_RANGE(X, OFFSET, SHIFT)	\
@@ -868,9 +868,9 @@ extern int arc_initial_elimination_offset(int from, int to);
 
 /* Recognize any constant value that is a valid address.  */
 #define CONSTANT_ADDRESS_P(X)					\
-  (flag_pic ? (arc_legitimate_pic_addr_p (X) || LABEL_P (X)):	\
-   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF	\
-    || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST))
+  (flag_pic ? (arc_legitimate_pic_addr_p (X) || LABEL_P (X))	\
+   : (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF	\
+      || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST))
 
 /* Is the argument a const_int rtx, containing an exact power of 2 */
 #define  IS_POWEROF2_P(X) (! ( (X) & ((X) - 1)) && (X))
diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index 5c11621327e1..50dd005ba10a 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -24730,11 +24730,11 @@ arm_print_operand (FILE *stream, rtx x, int code)
 	    asm_fprintf (stream, "[%r", REGNO (XEXP (addr, 0)));
 	    inc_val = GET_MODE_SIZE (GET_MODE (x));
 	    if (code == POST_INC || code == POST_DEC)
-	      asm_fprintf (stream, "], #%s%d",(code == POST_INC)
-					      ? "": "-", inc_val);
+	      asm_fprintf (stream, "], #%s%d", (code == POST_INC)
+					       ? "" : "-", inc_val);
 	    else
-	      asm_fprintf (stream, ", #%s%d]!",(code == PRE_INC)
-					       ? "": "-", inc_val);
+	      asm_fprintf (stream, ", #%s%d]!", (code == PRE_INC)
+						? "" : "-", inc_val);
 	  }
 	else if (code == POST_MODIFY || code == PRE_MODIFY)
 	  {
@@ -24743,9 +24743,9 @@ arm_print_operand (FILE *stream, rtx x, int code)
 	    if (postinc_reg && CONST_INT_P (postinc_reg))
 	      {
 		if (code == POST_MODIFY)
-		  asm_fprintf (stream, "], #%wd",INTVAL (postinc_reg));
+		  asm_fprintf (stream, "], #%wd", INTVAL (postinc_reg));
 		else
-		  asm_fprintf (stream, ", #%wd]!",INTVAL (postinc_reg));
+		  asm_fprintf (stream, ", #%wd]!", INTVAL (postinc_reg));
 	      }
 	  }
 	else if (code == PLUS)
diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md
index e066d5c920a9..55f4d106eec4 100644
--- a/gcc/config/cris/cris.md
+++ b/gcc/config/cris/cris.md
@@ -2418,7 +2418,7 @@
 		      (pc)))]
   "reload_completed"
 {
-  return <MODE>mode == CC_NZmode ? "b<oCC> %l0%#": "b<CC> %l0%#";
+  return <MODE>mode == CC_NZmode ? "b<oCC> %l0%#" : "b<CC> %l0%#";
 }
   [(set_attr "slottable" "has_slot")])
 
diff --git a/gcc/config/darwin-driver.cc b/gcc/config/darwin-driver.cc
index eabe9bc970d1..546ca242129b 100644
--- a/gcc/config/darwin-driver.cc
+++ b/gcc/config/darwin-driver.cc
@@ -370,7 +370,7 @@ darwin_driver_init (unsigned int *decoded_options_count,
     {
       if (seenX86_64 || seenM64)
 	{
-	  const char *op = (seenX86_64? "-arch x86_64": "-m64");
+	  const char *op = (seenX86_64 ? "-arch x86_64" : "-m64");
 	  warning (0, "%qs conflicts with %<-arch i386%> (%qs ignored)",
 		   op, op);
 	}
@@ -393,7 +393,7 @@ darwin_driver_init (unsigned int *decoded_options_count,
     {
       if (seenPPC64 || seenM64)
 	{
-	  const char *op = (seenPPC64? "-arch ppc64": "-m64");
+	  const char *op = (seenPPC64 ? "-arch ppc64" : "-m64");
 	  warning (0, "%qs conflicts with %<-arch ppc%> (%qs ignored)",
 		   op, op);
 	}
diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc
index 9129378be373..47e41ac8a123 100644
--- a/gcc/config/darwin.cc
+++ b/gcc/config/darwin.cc
@@ -2403,7 +2403,7 @@ darwin_asm_declare_object_name (FILE *file,
 #ifdef DEBUG_DARWIN_MEM_ALLOCATORS
 fprintf (file, "# dadon: %s %s (%llu, %u) local %d weak %d"
 	       " stat %d com %d pub %d t-const %d t-ro %d init %lx\n",
-	xname, (TREE_CODE (decl) == VAR_DECL?"var":"const"),
+	xname, TREE_CODE (decl) == VAR_DECL ? "var" : "const",
 	(unsigned long long)size, DECL_ALIGN (decl), local_def,
 	DECL_WEAK (decl), TREE_STATIC (decl), DECL_COMMON (decl),
 	TREE_PUBLIC (decl), TREE_CONSTANT (decl), TREE_READONLY (decl),
@@ -2641,7 +2641,7 @@ darwin_emit_common (FILE *fp, const char *name,
   fputs ("\t.comm\t", fp);
   assemble_name (fp, name);
   fprintf (fp, "," HOST_WIDE_INT_PRINT_UNSIGNED,
-	   emit_aligned_common?size:rounded);
+	   emit_aligned_common ? size : rounded);
   if (l2align && emit_aligned_common)
     fprintf (fp, ",%u", l2align);
   fputs ("\n", fp);
diff --git a/gcc/config/epiphany/epiphany.md b/gcc/config/epiphany/epiphany.md
index 395ddd5d5883..af6cd39ece39 100644
--- a/gcc/config/epiphany/epiphany.md
+++ b/gcc/config/epiphany/epiphany.md
@@ -2187,14 +2187,14 @@
   if (epiphany_uninterruptible_p (current_function_decl)
       != target_uninterruptible)
     {
-      emit_insn (target_uninterruptible ? gen_gid (): gen_gie ());
+      emit_insn (target_uninterruptible ? gen_gid () : gen_gie ());
       emit_call_insn
 	(gen_rtx_PARALLEL
 	  (VOIDmode,
 	   gen_rtvec (2, gen_rtx_CALL (VOIDmode, operands[0], operands[1]),
 			 gen_rtx_CLOBBER (VOIDmode,
 					  gen_rtx_REG (SImode, GPR_LR)))));
-      emit_insn (target_uninterruptible ? gen_gie (): gen_gid ());
+      emit_insn (target_uninterruptible ? gen_gie () : gen_gid ());
       DONE;
     }
 })
@@ -2225,13 +2225,13 @@
   if (epiphany_uninterruptible_p (current_function_decl)
       != target_uninterruptible)
     {
-      emit_insn (target_uninterruptible ? gen_gid (): gen_gie ());
+      emit_insn (target_uninterruptible ? gen_gid () : gen_gie ());
       emit_call_insn
 	(gen_rtx_PARALLEL
 	  (VOIDmode,
 	   gen_rtvec (2, gen_rtx_CALL (VOIDmode, operands[0], operands[1]),
 			 ret_rtx)));
-      emit_insn (target_uninterruptible ? gen_gie (): gen_gid ());
+      emit_insn (target_uninterruptible ? gen_gie () : gen_gid ());
       DONE;
     }
 })
@@ -2264,7 +2264,7 @@
   if (epiphany_uninterruptible_p (current_function_decl)
       != target_uninterruptible)
     {
-      emit_insn (target_uninterruptible ? gen_gid (): gen_gie ());
+      emit_insn (target_uninterruptible ? gen_gid () : gen_gie ());
       emit_call_insn
 	(gen_rtx_PARALLEL
 	  (VOIDmode,
@@ -2273,7 +2273,7 @@
 			    gen_rtx_CALL (VOIDmode, operands[1], operands[2])),
 			 gen_rtx_CLOBBER (VOIDmode,
 					  gen_rtx_REG (SImode, GPR_LR)))));
-      emit_insn (target_uninterruptible ? gen_gie (): gen_gid ());
+      emit_insn (target_uninterruptible ? gen_gie () : gen_gid ());
       DONE;
     }
 })
@@ -2307,7 +2307,7 @@
   if (epiphany_uninterruptible_p (current_function_decl)
       != target_uninterruptible)
     {
-      emit_insn (target_uninterruptible ? gen_gid (): gen_gie ());
+      emit_insn (target_uninterruptible ? gen_gid () : gen_gie ());
       emit_call_insn
 	(gen_rtx_PARALLEL
 	  (VOIDmode,
@@ -2315,7 +2315,7 @@
 			   (operands[0],
 			    gen_rtx_CALL (VOIDmode, operands[1], operands[2])),
 			 ret_rtx)));
-      emit_insn (target_uninterruptible ? gen_gie (): gen_gid ());
+      emit_insn (target_uninterruptible ? gen_gie () : gen_gid ());
       DONE;
     }
 })
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index a1f0ae7a7e16..68d038da3f90 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -6580,8 +6580,8 @@ gen_push2 (rtx mem, rtx reg1, rtx reg2, bool ppx_p = false)
   if (REG_P (reg2) && GET_MODE (reg2) != word_mode)
     reg2 = gen_rtx_REG (word_mode, REGNO (reg2));
 
-  return ppx_p ? gen_push2p_di (mem, reg1, reg2):
-		 gen_push2_di (mem, reg1, reg2);
+  return ppx_p ? gen_push2p_di (mem, reg1, reg2)
+	       : gen_push2_di (mem, reg1, reg2);
 }
 
 /* Return >= 0 if there is an unused call-clobbered register available
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index f5204aa1ed23..f3c98f585f8c 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -238,7 +238,7 @@ extern const struct processor_costs *ix86_cost;
 extern const struct processor_costs ix86_size_cost;
 
 #define ix86_cur_cost() \
-  (optimize_insn_for_size_p () ? &ix86_size_cost: ix86_cost)
+  (optimize_insn_for_size_p () ? &ix86_size_cost : ix86_cost)
 
 /* Macros used in the machine description to test the flags.  */
 
diff --git a/gcc/config/i386/openbsdelf.h b/gcc/config/i386/openbsdelf.h
index 3b7c27b43dc2..89982b952ead 100644
--- a/gcc/config/i386/openbsdelf.h
+++ b/gcc/config/i386/openbsdelf.h
@@ -67,7 +67,7 @@ along with GCC; see the file COPYING3.  If not see
    The icky part is not here, but in <machine/profile.h>.  */
 #undef FUNCTION_PROFILER
 #define FUNCTION_PROFILER(FILE, LABELNO)  \
-  fputs (flag_pic ? "\tcall __mcount@PLT\n": "\tcall __mcount\n", FILE);
+  fputs (flag_pic ? "\tcall __mcount@PLT\n" : "\tcall __mcount\n", FILE);
 
 #undef LINK_SPEC
 #define LINK_SPEC \
diff --git a/gcc/config/loongarch/loongarch-c.cc b/gcc/config/loongarch/loongarch-c.cc
index c6763647cd13..97e1baffc42b 100644
--- a/gcc/config/loongarch/loongarch-c.cc
+++ b/gcc/config/loongarch/loongarch-c.cc
@@ -116,7 +116,7 @@ loongarch_cpu_cpp_builtins (cpp_reader *pfile)
 
 	max_v_major = major > max_v_major ? major : max_v_major;
 	max_v_minor = major == max_v_major
-	  ? (minor > max_v_minor ? minor : max_v_minor): max_v_minor;
+	  ? (minor > max_v_minor ? minor : max_v_minor) : max_v_minor;
       }
 
   /* Find the minimum ISA version required to run the target program.  */
diff --git a/gcc/config/loongarch/loongarch-cpu.cc b/gcc/config/loongarch/loongarch-cpu.cc
index 8564ebb24eea..343751b65792 100644
--- a/gcc/config/loongarch/loongarch-cpu.cc
+++ b/gcc/config/loongarch/loongarch-cpu.cc
@@ -265,11 +265,11 @@ fill_native_cpu_config (struct loongarch_target *tgt)
       l1u_present |= cpucfg_cache[16] & 3;	  /* bit[1:0]: unified l1 */
       l1d_present |= cpucfg_cache[16] & 4;	  /* bit[2:2]: l1d */
       l1_szword = l1d_present ? 18 : (l1u_present ? 17 : 0);
-      l1_szword = l1_szword ? cpucfg_cache[l1_szword]: 0;
+      l1_szword = l1_szword ? cpucfg_cache[l1_szword] : 0;
 
       l2d_present |= cpucfg_cache[16] & 24;	  /* bit[4:3]: unified l2 */
       l2d_present |= cpucfg_cache[16] & 128;	  /* bit[7:7]: l2d */
-      l2_szword = l2d_present ? cpucfg_cache[19]: 0;
+      l2_szword = l2d_present ? cpucfg_cache[19] : 0;
 
       native_cache.l1d_line_size
 	= 1 << ((l1_szword & 0x7f000000) >> 24);  /* bit[30:24]: log2(line) */
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index e111cb072840..3ac40234345a 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -6622,8 +6622,8 @@ riscv_union_memmodels (enum memmodel model1, enum memmodel model2)
   model1 = memmodel_base (model1);
   model2 = memmodel_base (model2);
 
-  enum memmodel weaker = model1 <= model2 ? model1: model2;
-  enum memmodel stronger = model1 > model2 ? model1: model2;
+  enum memmodel weaker = model1 <= model2 ? model1 : model2;
+  enum memmodel stronger = model1 > model2 ? model1 : model2;
 
   switch (stronger)
     {
diff --git a/gcc/config/riscv/zc.md b/gcc/config/riscv/zc.md
index 5b948b41586f..6dc47da3acc9 100644
--- a/gcc/config/riscv/zc.md
+++ b/gcc/config/riscv/zc.md
@@ -1442,7 +1442,7 @@
         (match_operand:X 3 "zcmp_mv_sreg_operand" "r"))]
   "TARGET_ZCMP
    && (REGNO (operands[2]) != REGNO (operands[0]))"
-  { return (REGNO (operands[0]) == A0_REGNUM)?"cm.mva01s\t%1,%3":"cm.mva01s\t%3,%1"; }
+  { return (REGNO (operands[0]) == A0_REGNUM) ? "cm.mva01s\t%1,%3" : "cm.mva01s\t%3,%1"; }
   [(set_attr "mode" "<X:MODE>")
    (set_attr "type" "mvpair")])
 
@@ -1454,6 +1454,6 @@
   "TARGET_ZCMP
    && (REGNO (operands[0]) != REGNO (operands[2]))
    && (REGNO (operands[1]) != REGNO (operands[3]))"
-  { return (REGNO (operands[1]) == A0_REGNUM)?"cm.mvsa01\t%0,%2":"cm.mvsa01\t%2,%0"; }
+  { return (REGNO (operands[1]) == A0_REGNUM) ? "cm.mvsa01\t%0,%2" : "cm.mvsa01\t%2,%0"; }
   [(set_attr "mode" "<X:MODE>")
    (set_attr "type" "mvpair")])
diff --git a/gcc/config/rs6000/mmintrin.h b/gcc/config/rs6000/mmintrin.h
index c7988c1c3146..68c06aa0265f 100644
--- a/gcc/config/rs6000/mmintrin.h
+++ b/gcc/config/rs6000/mmintrin.h
@@ -743,14 +743,14 @@ _mm_cmpeq_pi8 (__m64 __m1, __m64 __m2)
   __mu1.as_m64 = __m1;
   __mu2.as_m64 = __m2;
 
-  __res.as_char[0] = (__mu1.as_char[0] == __mu2.as_char[0])? -1: 0;
-  __res.as_char[1] = (__mu1.as_char[1] == __mu2.as_char[1])? -1: 0;
-  __res.as_char[2] = (__mu1.as_char[2] == __mu2.as_char[2])? -1: 0;
-  __res.as_char[3] = (__mu1.as_char[3] == __mu2.as_char[3])? -1: 0;
-  __res.as_char[4] = (__mu1.as_char[4] == __mu2.as_char[4])? -1: 0;
-  __res.as_char[5] = (__mu1.as_char[5] == __mu2.as_char[5])? -1: 0;
-  __res.as_char[6] = (__mu1.as_char[6] == __mu2.as_char[6])? -1: 0;
-  __res.as_char[7] = (__mu1.as_char[7] == __mu2.as_char[7])? -1: 0;
+  __res.as_char[0] = (__mu1.as_char[0] == __mu2.as_char[0]) ? -1 : 0;
+  __res.as_char[1] = (__mu1.as_char[1] == __mu2.as_char[1]) ? -1 : 0;
+  __res.as_char[2] = (__mu1.as_char[2] == __mu2.as_char[2]) ? -1 : 0;
+  __res.as_char[3] = (__mu1.as_char[3] == __mu2.as_char[3]) ? -1 : 0;
+  __res.as_char[4] = (__mu1.as_char[4] == __mu2.as_char[4]) ? -1 : 0;
+  __res.as_char[5] = (__mu1.as_char[5] == __mu2.as_char[5]) ? -1 : 0;
+  __res.as_char[6] = (__mu1.as_char[6] == __mu2.as_char[6]) ? -1 : 0;
+  __res.as_char[7] = (__mu1.as_char[7] == __mu2.as_char[7]) ? -1 : 0;
 
   return (__m64) __res.as_m64;
 #endif
@@ -778,14 +778,14 @@ _mm_cmpgt_pi8 (__m64 __m1, __m64 __m2)
   __mu1.as_m64 = __m1;
   __mu2.as_m64 = __m2;
 
-  __res.as_char[0] = (__mu1.as_char[0] > __mu2.as_char[0])? -1: 0;
-  __res.as_char[1] = (__mu1.as_char[1] > __mu2.as_char[1])? -1: 0;
-  __res.as_char[2] = (__mu1.as_char[2] > __mu2.as_char[2])? -1: 0;
-  __res.as_char[3] = (__mu1.as_char[3] > __mu2.as_char[3])? -1: 0;
-  __res.as_char[4] = (__mu1.as_char[4] > __mu2.as_char[4])? -1: 0;
-  __res.as_char[5] = (__mu1.as_char[5] > __mu2.as_char[5])? -1: 0;
-  __res.as_char[6] = (__mu1.as_char[6] > __mu2.as_char[6])? -1: 0;
-  __res.as_char[7] = (__mu1.as_char[7] > __mu2.as_char[7])? -1: 0;
+  __res.as_char[0] = (__mu1.as_char[0] > __mu2.as_char[0]) ? -1 : 0;
+  __res.as_char[1] = (__mu1.as_char[1] > __mu2.as_char[1]) ? -1 : 0;
+  __res.as_char[2] = (__mu1.as_char[2] > __mu2.as_char[2]) ? -1 : 0;
+  __res.as_char[3] = (__mu1.as_char[3] > __mu2.as_char[3]) ? -1 : 0;
+  __res.as_char[4] = (__mu1.as_char[4] > __mu2.as_char[4]) ? -1 : 0;
+  __res.as_char[5] = (__mu1.as_char[5] > __mu2.as_char[5]) ? -1 : 0;
+  __res.as_char[6] = (__mu1.as_char[6] > __mu2.as_char[6]) ? -1 : 0;
+  __res.as_char[7] = (__mu1.as_char[7] > __mu2.as_char[7]) ? -1 : 0;
 
   return (__m64) __res.as_m64;
 #endif
@@ -815,10 +815,10 @@ _mm_cmpeq_pi16 (__m64 __m1, __m64 __m2)
   __mu1.as_m64 = __m1;
   __mu2.as_m64 = __m2;
 
-  __res.as_short[0] = (__mu1.as_short[0] == __mu2.as_short[0])? -1: 0;
-  __res.as_short[1] = (__mu1.as_short[1] == __mu2.as_short[1])? -1: 0;
-  __res.as_short[2] = (__mu1.as_short[2] == __mu2.as_short[2])? -1: 0;
-  __res.as_short[3] = (__mu1.as_short[3] == __mu2.as_short[3])? -1: 0;
+  __res.as_short[0] = (__mu1.as_short[0] == __mu2.as_short[0]) ? -1 : 0;
+  __res.as_short[1] = (__mu1.as_short[1] == __mu2.as_short[1]) ? -1 : 0;
+  __res.as_short[2] = (__mu1.as_short[2] == __mu2.as_short[2]) ? -1 : 0;
+  __res.as_short[3] = (__mu1.as_short[3] == __mu2.as_short[3]) ? -1 : 0;
 
   return (__m64) __res.as_m64;
 #endif
@@ -846,10 +846,10 @@ _mm_cmpgt_pi16 (__m64 __m1, __m64 __m2)
   __mu1.as_m64 = __m1;
   __mu2.as_m64 = __m2;
 
-  __res.as_short[0] = (__mu1.as_short[0] > __mu2.as_short[0])? -1: 0;
-  __res.as_short[1] = (__mu1.as_short[1] > __mu2.as_short[1])? -1: 0;
-  __res.as_short[2] = (__mu1.as_short[2] > __mu2.as_short[2])? -1: 0;
-  __res.as_short[3] = (__mu1.as_short[3] > __mu2.as_short[3])? -1: 0;
+  __res.as_short[0] = (__mu1.as_short[0] > __mu2.as_short[0]) ? -1 : 0;
+  __res.as_short[1] = (__mu1.as_short[1] > __mu2.as_short[1]) ? -1 : 0;
+  __res.as_short[2] = (__mu1.as_short[2] > __mu2.as_short[2]) ? -1 : 0;
+  __res.as_short[3] = (__mu1.as_short[3] > __mu2.as_short[3]) ? -1 : 0;
 
   return (__m64) __res.as_m64;
 #endif
@@ -879,8 +879,8 @@ _mm_cmpeq_pi32 (__m64 __m1, __m64 __m2)
   __mu1.as_m64 = __m1;
   __mu2.as_m64 = __m2;
 
-  __res.as_int[0] = (__mu1.as_int[0] == __mu2.as_int[0])? -1: 0;
-  __res.as_int[1] = (__mu1.as_int[1] == __mu2.as_int[1])? -1: 0;
+  __res.as_int[0] = (__mu1.as_int[0] == __mu2.as_int[0]) ? -1 : 0;
+  __res.as_int[1] = (__mu1.as_int[1] == __mu2.as_int[1]) ? -1 : 0;
 
   return (__m64) __res.as_m64;
 #endif
@@ -908,8 +908,8 @@ _mm_cmpgt_pi32 (__m64 __m1, __m64 __m2)
   __mu1.as_m64 = __m1;
   __mu2.as_m64 = __m2;
 
-  __res.as_int[0] = (__mu1.as_int[0] > __mu2.as_int[0])? -1: 0;
-  __res.as_int[1] = (__mu1.as_int[1] > __mu2.as_int[1])? -1: 0;
+  __res.as_int[0] = (__mu1.as_int[0] > __mu2.as_int[0]) ? -1 : 0;
+  __res.as_int[1] = (__mu1.as_int[1] > __mu2.as_int[1]) ? -1 : 0;
 
   return (__m64) __res.as_m64;
 #endif
diff --git a/gcc/config/v850/predicates.md b/gcc/config/v850/predicates.md
index 3e76bdaa75fc..751cf72a723a 100644
--- a/gcc/config/v850/predicates.md
+++ b/gcc/config/v850/predicates.md
@@ -182,7 +182,7 @@
 
      */
 
-  for (i = 2; i < count - (TARGET_LONG_CALLS ? 2: 1); i++)
+  for (i = 2; i < count - (TARGET_LONG_CALLS ? 2 : 1); i++)
     {
       rtx dest;
       rtx src;
diff --git a/gcc/config/xtensa/constraints.md b/gcc/config/xtensa/constraints.md
index d855fb8d6057..c96959ed0e52 100644
--- a/gcc/config/xtensa/constraints.md
+++ b/gcc/config/xtensa/constraints.md
@@ -32,7 +32,7 @@
   General-purpose AR registers for indirect sibling calls, @code{a2}-
   @code{a8}.")
 
-(define_register_constraint "d" "TARGET_DENSITY ? AR_REGS: NO_REGS"
+(define_register_constraint "d" "TARGET_DENSITY ? AR_REGS : NO_REGS"
  "@internal
   All AR registers, including sp, but only if the Xtensa Code Density
   Option is configured.")
@@ -53,7 +53,7 @@
   General-purpose AR registers, but only if the Xtensa Sign Extend
   Option is configured.")
 
-(define_register_constraint "C" "TARGET_MUL16 ? GR_REGS: NO_REGS"
+(define_register_constraint "C" "TARGET_MUL16 ? GR_REGS : NO_REGS"
  "@internal
   General-purpose AR registers, but only if the Xtensa 16-Bit Integer
   Multiply Option is configured.")
@@ -63,7 +63,7 @@
   General-purpose AR registers, but only if the Xtensa Code Density
   Option is configured.")
 
-(define_register_constraint "W" "TARGET_CONST16 ? GR_REGS: NO_REGS"
+(define_register_constraint "W" "TARGET_CONST16 ? GR_REGS : NO_REGS"
  "@internal
   General-purpose AR registers, but only if the Xtensa Const16
   Option is configured.")
diff --git a/gcc/coverage.cc b/gcc/coverage.cc
index 22778361da13..a964ed5a48fe 100644
--- a/gcc/coverage.cc
+++ b/gcc/coverage.cc
@@ -658,7 +658,7 @@ coverage_begin_function (unsigned lineno_checksum, unsigned cfg_checksum)
   int end_line
     = endloc.file == startloc.file ? endloc.line : startloc.line;
   int end_column
-    = endloc.file == startloc.file ? endloc.column: startloc.column;
+    = endloc.file == startloc.file ? endloc.column : startloc.column;
 
   if (startloc.line > end_line)
     {
@@ -1089,8 +1089,8 @@ build_init_ctor (tree gcov_info_type)
   append_to_statement_list (stmt, &ctor);
 
   /* Generate a constructor to run it.  */
-  int priority = SUPPORTS_INIT_PRIORITY
-    ? MAX_RESERVED_INIT_PRIORITY: DEFAULT_INIT_PRIORITY;
+  int priority = (SUPPORTS_INIT_PRIORITY
+		  ? MAX_RESERVED_INIT_PRIORITY : DEFAULT_INIT_PRIORITY);
   cgraph_build_static_cdtor ('I', ctor, priority);
 }
 
@@ -1112,8 +1112,8 @@ build_gcov_exit_decl (void)
   append_to_statement_list (stmt, &dtor);
 
   /* Generate a destructor to run it.  */
-  int priority = SUPPORTS_INIT_PRIORITY
-    ? MAX_RESERVED_INIT_PRIORITY: DEFAULT_INIT_PRIORITY;
+  int priority = (SUPPORTS_INIT_PRIORITY
+		  ? MAX_RESERVED_INIT_PRIORITY : DEFAULT_INIT_PRIORITY);
 
   cgraph_build_static_cdtor ('D', dtor, priority);
 }
diff --git a/gcc/cp/search.cc b/gcc/cp/search.cc
index b0421ee05247..54eb4f4010f2 100644
--- a/gcc/cp/search.cc
+++ b/gcc/cp/search.cc
@@ -1290,7 +1290,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type,
       && !dguide_name_p (name))
     rval = build_baselink (rval_binfo, basetype_path, rval,
 			   (IDENTIFIER_CONV_OP_P (name)
-			   ? TREE_TYPE (name): NULL_TREE));
+			    ? TREE_TYPE (name) : NULL_TREE));
   return rval;
 }
 
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index d1204d922bbd..71d879abef12 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -9829,7 +9829,7 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
 	}
 
       from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
-		   ? 1 + (modifycode != INIT_EXPR): 0;
+		   ? 1 + (modifycode != INIT_EXPR) : 0;
       result = build_vec_init (lhs, NULL_TREE, newrhs,
 			       /*explicit_value_init_p=*/false,
 			       from_array, complain);
diff --git a/gcc/df-problems.cc b/gcc/df-problems.cc
index bfd24bd1e86c..f1dba2b5540e 100644
--- a/gcc/df-problems.cc
+++ b/gcc/df-problems.cc
@@ -3532,7 +3532,7 @@ df_create_unused_note (rtx_insn *insn, df_ref def,
 	|| df_ignore_stack_reg (dregno)))
     {
       rtx reg = (DF_REF_LOC (def))
-                ? *DF_REF_REAL_LOC (def): DF_REF_REG (def);
+		? *DF_REF_REAL_LOC (def) : DF_REF_REG (def);
       df_set_note (REG_UNUSED, insn, reg);
       dead_debug_insert_temp (debug, dregno, insn, DEBUG_TEMP_AFTER_WITH_REG);
       if (REG_DEAD_DEBUGGING)
diff --git a/gcc/diagnostic-path.cc b/gcc/diagnostic-path.cc
index 3f7d4fb50156..2c42807cced9 100644
--- a/gcc/diagnostic-path.cc
+++ b/gcc/diagnostic-path.cc
@@ -795,7 +795,7 @@ path_summary::path_summary (const path_print_policy &policy,
 	  continue;
 
       auto theme = policy.get_diagram_theme ();
-      const bool allow_emojis = theme ? theme->emojis_p (): false;
+      const bool allow_emojis = theme ? theme->emojis_p () : false;
       cur_event_range = new event_range (path, idx, event, pts,
 					 show_event_links,
 					 colorize,
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 41656a607b81..5e092cc2d475 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -118,7 +118,7 @@ diagnostic_set_caret_max_width (diagnostic_context *context, int value)
   /* One minus to account for the leading empty space.  */
   value = value ? value - 1 
     : (isatty (fileno (pp_buffer (context->m_printer)->m_stream))
-       ? get_terminal_width () - 1: INT_MAX);
+       ? get_terminal_width () - 1 : INT_MAX);
   
   if (value <= 0) 
     value = INT_MAX;
diff --git a/gcc/expr.cc b/gcc/expr.cc
index ed64ccea7663..b7a04f76fbf6 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -9670,7 +9670,7 @@ expand_expr_divmod (tree_code code, machine_mode mode, tree treeop0,
 
       if (dump_file && (dump_flags & TDF_DETAILS))
 	  fprintf(dump_file, "positive division:%s unsigned cost: %u; "
-		  "signed cost: %u\n", was_tie ? "(needed tie breaker)":"",
+		  "signed cost: %u\n", was_tie ? "(needed tie breaker)" : "",
 		  uns_cost, sgn_cost);
 
       if (uns_cost < sgn_cost || (uns_cost == sgn_cost && unsignedp))
diff --git a/gcc/gcov-dump.cc b/gcc/gcov-dump.cc
index 375058c3c7b7..731172f39ee1 100644
--- a/gcc/gcov-dump.cc
+++ b/gcc/gcov-dump.cc
@@ -299,8 +299,8 @@ dump_gcov_file (const char *filename)
       gcov_sync (base, length);
       if ((error = gcov_is_error ()))
 	{
-	  printf (error < 0 ? "%s:counter overflow at %lu\n" :
-		  "%s:read error at %lu\n", filename,
+	  printf (error < 0 ? "%s:counter overflow at %lu\n"
+		  : "%s:read error at %lu\n", filename,
 		  (long unsigned) gcov_position ());
 	  break;
 	}
diff --git a/gcc/gcov.cc b/gcc/gcov.cc
index e1334e75012b..514ff1c93b99 100644
--- a/gcc/gcov.cc
+++ b/gcc/gcov.cc
@@ -2733,7 +2733,7 @@ format_gcov (gcov_type top, gcov_type bottom, int decimal_places)
 
   if (decimal_places >= 0)
     {
-      float ratio = bottom ? 100.0f * top / bottom: 0;
+      float ratio = bottom ? 100.0f * top / bottom : 0;
 
       /* Round up to 1% if there's a small non-zero value.  */
       if (ratio > 0.0f && ratio < 0.5f && decimal_places == 0)
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
index 4020bec73c41..6287d6a7bc2e 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -6115,8 +6115,8 @@ main (int argc, char **argv)
 
   if (!cpp_read_main_file (r, input))
     return 1;
-  cpp_define (r, gimple ? "GIMPLE=1": "GENERIC=1");
-  cpp_define (r, gimple ? "GENERIC=0": "GIMPLE=0");
+  cpp_define (r, gimple ? "GIMPLE=1" : "GENERIC=1");
+  cpp_define (r, gimple ? "GENERIC=0" : "GIMPLE=0");
 
   null_id = new id_base (id_base::NULL_ID, "null");
 
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
index 0193ccfe30fe..63ad664208d2 100644
--- a/gcc/incpath.cc
+++ b/gcc/incpath.cc
@@ -313,7 +313,7 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
 
       /* Remove this entry from the chain.  */
       *pcur = cur->next;
-      free_path (cur, verbose ? reason: REASON_QUIET);
+      free_path (cur, verbose ? reason : REASON_QUIET);
     }
 
   *pcur = join;
@@ -495,7 +495,7 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
     { "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH",
       "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH" };
   cpp_options *cpp_opts = cpp_get_options (pfile);
-  size_t idx = (cpp_opts->objc ? 2: 0);
+  size_t idx = (cpp_opts->objc ? 2 : 0);
 
   if (cpp_opts->cplusplus)
     idx++;
diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc
index a7ce434bffb4..c406e5138db6 100644
--- a/gcc/ipa-devirt.cc
+++ b/gcc/ipa-devirt.cc
@@ -2146,8 +2146,8 @@ dump_odr_type (FILE *f, odr_type t, int indent=0)
   unsigned int i;
   fprintf (f, "%*s type %i: ", indent * 2, "", t->id);
   print_generic_expr (f, t->type, TDF_SLIM);
-  fprintf (f, "%s", t->anonymous_namespace ? " (anonymous namespace)":"");
-  fprintf (f, "%s\n", t->all_derivations_known ? " (derivations known)":"");
+  fprintf (f, "%s", t->anonymous_namespace ? " (anonymous namespace)" : "");
+  fprintf (f, "%s\n", t->all_derivations_known ? " (derivations known)" : "");
   if (TYPE_NAME (t->type))
     {
       if (DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t->type)))
diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc
index 6f9941522c8f..b10a6baf1097 100644
--- a/gcc/ipa-icf.cc
+++ b/gcc/ipa-icf.cc
@@ -3410,7 +3410,7 @@ sem_item_optimizer::merge_classes (unsigned int prev_class_count,
       unsigned total = equal_items + non_singular_classes_count;
       fprintf (dump_file, "Totally needed symbols: %u"
 	       ", fraction of loaded symbols: %.2f%%\n\n", total,
-	       loaded_symbols ? 100.0f * total / loaded_symbols: 0.0f);
+	       loaded_symbols ? 100.0f * total / loaded_symbols : 0.0f);
     }
 
   unsigned int l;
diff --git a/gcc/ipa-inline.cc b/gcc/ipa-inline.cc
index 9fc41b7696d8..f15e141aa527 100644
--- a/gcc/ipa-inline.cc
+++ b/gcc/ipa-inline.cc
@@ -2447,7 +2447,8 @@ inline_small_functions (void)
 			   s->time.to_double (),
 			   ipa_size_summaries->get (edge->caller)->size,
 			   buf_net_change,
-			   cross_module_call_p (edge) ? " (cross module)":"");
+			   cross_module_call_p (edge)
+			   ? " (cross module)" : "");
 	}
       if (min_size > overall_size)
 	{
@@ -2463,7 +2464,7 @@ inline_small_functions (void)
     dump_printf (MSG_NOTE,
 		 "Unit growth for small function inlining: %i->%i (%i%%)\n",
 		 initial_size, overall_size,
-		 initial_size ? overall_size * 100 / (initial_size) - 100: 0);
+		 initial_size ? overall_size * 100 / (initial_size) - 100 : 0);
   symtab->remove_edge_removal_hook (edge_removal_hook_holder);
 }
 
diff --git a/gcc/ipa-polymorphic-call.cc b/gcc/ipa-polymorphic-call.cc
index 81de6d7fc33a..7d3df7c474cc 100644
--- a/gcc/ipa-polymorphic-call.cc
+++ b/gcc/ipa-polymorphic-call.cc
@@ -624,7 +624,7 @@ ipa_polymorphic_call_context::dump (FILE *f, bool newline) const
 	fprintf (f, "nothing known");
       if (outer_type || offset)
 	{
-	  fprintf (f, "Outer type%s:", dynamic ? " (dynamic)":"");
+	  fprintf (f, "Outer type%s:", dynamic ? " (dynamic)" : "");
 	  print_generic_expr (f, outer_type, TDF_SLIM);
 	  if (maybe_derived_type)
 	    fprintf (f, " (or a derived type)");
diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 6d6da4089251..04920f2aa8e4 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -1256,7 +1256,7 @@ create_parameter_descriptors (cgraph_node *node,
 	    fprintf (dump_file, " is a scalar with only %i call uses%s\n",
 		     desc->call_uses,
 		     desc->remove_only_when_retval_removed
-		     ? " and return uses": "");
+		     ? " and return uses" : "");
 	}
 
       if (POINTER_TYPE_P (type))
diff --git a/gcc/ipa-utils.cc b/gcc/ipa-utils.cc
index dbfc60ff8acb..2366fa778d15 100644
--- a/gcc/ipa-utils.cc
+++ b/gcc/ipa-utils.cc
@@ -1012,11 +1012,16 @@ find_always_executed_bbs (function *fun, bool assume_return_or_eh)
 	  cstate->low = MIN (cstate->low, (*cstate2)->low);
 	  cstate->high = MAX (cstate->high, (*cstate2)->high);
 	}
-      if (dump_file && (dump_flags & TDF_DETAILS) && bb != EXIT_BLOCK_PTR_FOR_FN (fun))
-	fprintf (dump_file, "BB %i %s preorder %i posorder %i low %i high %i\n",
-		 bb->index, terminating_bbs_set.contains (bb) ? "(terminating)": "",
-		 cstate->dfs_preorder, cstate->dfs_postorder, cstate->low, cstate->high);
-      if (cstate->low == cstate->dfs_preorder && cstate->high == cstate->dfs_postorder
+      if (dump_file && (dump_flags & TDF_DETAILS)
+	  && bb != EXIT_BLOCK_PTR_FOR_FN (fun))
+	fprintf (dump_file,
+		 "BB %i %s preorder %i posorder %i low %i high %i\n",
+		 bb->index,
+		 terminating_bbs_set.contains (bb) ? "(terminating)" : "",
+		 cstate->dfs_preorder, cstate->dfs_postorder, cstate->low,
+		 cstate->high);
+      if (cstate->low == cstate->dfs_preorder
+	  && cstate->high == cstate->dfs_postorder
 	  && bb != EXIT_BLOCK_PTR_FOR_FN (fun))
 	bitmap_set_bit (ret, bb->index);
       if (terminating_bbs_set.contains (bb))
@@ -1035,7 +1040,7 @@ find_always_executed_bbs (function *fun, bool assume_return_or_eh)
   if (dump_file)
     {
       fprintf (dump_file, "Always executed bbbs %s: ",
-	       assume_return_or_eh ? "(assuming return or EH)": "");
+	       assume_return_or_eh ? "(assuming return or EH)" : "");
       bitmap_print (dump_file, ret, "", "\n");
     }
 
diff --git a/gcc/predict.cc b/gcc/predict.cc
index affa037371ca..87b34597662c 100644
--- a/gcc/predict.cc
+++ b/gcc/predict.cc
@@ -1989,7 +1989,7 @@ predict_loops (void)
 
       if (dump_file && (dump_flags & TDF_DETAILS))
 	fprintf (dump_file, "Predicting loop %i%s with %i exits.\n",
-		 loop->num, recursion ? " (with recursion)":"", n_exits);
+		 loop->num, recursion ? " (with recursion)" : "", n_exits);
       if (dump_file && (dump_flags & TDF_DETAILS)
 	  && max_loop_iterations_int (loop) >= 0)
 	{
diff --git a/gcc/selftest.cc b/gcc/selftest.cc
index 6438d86a6aa0..15284c3359c4 100644
--- a/gcc/selftest.cc
+++ b/gcc/selftest.cc
@@ -257,7 +257,7 @@ read_file (const location &loc, const char *path)
       /* Allow 1 extra byte for 0-termination.  */
       if (alloc_sz < (total_sz + 1))
 	{
-	  size_t new_alloc_sz = alloc_sz ? alloc_sz * 2: total_sz + 1;
+	  size_t new_alloc_sz = alloc_sz ? alloc_sz * 2 : total_sz + 1;
 	  result = (char *)xrealloc (result, new_alloc_sz);
 	  alloc_sz = new_alloc_sz;
 	}
diff --git a/gcc/sreal.h b/gcc/sreal.h
index 8104510a59e5..ee9811d6c559 100644
--- a/gcc/sreal.h
+++ b/gcc/sreal.h
@@ -30,8 +30,8 @@ along with GCC; see the file COPYING3.  If not see
 
 #define SREAL_BITS SREAL_PART_BITS
 
-#define SREAL_SIGN(v) (v < 0 ? -1: 1)
-#define SREAL_ABS(v) (v < 0 ? -v: v)
+#define SREAL_SIGN(v) (v < 0 ? -1 : 1)
+#define SREAL_ABS(v) (v < 0 ? -v : v)
 
 struct output_block;
 class lto_input_block;
diff --git a/gcc/tree-dump.cc b/gcc/tree-dump.cc
index 3b5864eecb67..ba3cf1a2fe3b 100644
--- a/gcc/tree-dump.cc
+++ b/gcc/tree-dump.cc
@@ -442,7 +442,8 @@ dequeue_and_dump (dump_info_p di)
     case INTEGER_TYPE:
     case ENUMERAL_TYPE:
       dump_int (di, "prec", TYPE_PRECISION (t));
-      dump_string_field (di, "sign", TYPE_UNSIGNED (t) ? "unsigned": "signed");
+      dump_string_field (di, "sign",
+			 TYPE_UNSIGNED (t) ? "unsigned" : "signed");
       dump_child ("min", TYPE_MIN_VALUE (t));
       dump_child ("max", TYPE_MAX_VALUE (t));
 
@@ -456,9 +457,11 @@ dequeue_and_dump (dump_info_p di)
 
     case FIXED_POINT_TYPE:
       dump_int (di, "prec", TYPE_PRECISION (t));
-      dump_string_field (di, "sign", TYPE_UNSIGNED (t) ? "unsigned": "signed");
+      dump_string_field (di, "sign",
+			 TYPE_UNSIGNED (t) ? "unsigned" : "signed");
       dump_string_field (di, "saturating",
-			 TYPE_SATURATING (t) ? "saturating": "non-saturating");
+			 TYPE_SATURATING (t)
+			 ? "saturating" : "non-saturating");
       break;
 
     case POINTER_TYPE:
diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc
index a5f6ef5f5ddd..db1287228239 100644
--- a/gcc/tree-ssa-ccp.cc
+++ b/gcc/tree-ssa-ccp.cc
@@ -1848,7 +1848,7 @@ bit_value_binop (enum tree_code code, signop sgn, int width,
 	/* Do a cross comparison of the max/min pairs.  */
 	maxmin = wi::cmp (max1, min2, r1type_sgn);
 	minmax = wi::cmp (min1, max2, r1type_sgn);
-	if (maxmin < (code == LE_EXPR ? 1: 0))  /* o1 < or <= o2.  */
+	if (maxmin < (code == LE_EXPR ? 1 : 0))  /* o1 < or <= o2.  */
 	  {
 	    *mask = 0;
 	    *val = 1;
diff --git a/libcpp/expr.cc b/libcpp/expr.cc
index b7772c9bd6c6..67d021f898a9 100644
--- a/libcpp/expr.cc
+++ b/libcpp/expr.cc
@@ -141,9 +141,9 @@ interpret_float_suffix (cpp_reader *pfile, const uchar *s, size_t len)
       bool uppercase = (*s == 'D');
       switch (s[1])
       {
-      case 'f': return (!uppercase ? (CPP_N_DFLOAT | CPP_N_SMALL): 0); break;
+      case 'f': return (!uppercase ? (CPP_N_DFLOAT | CPP_N_SMALL) : 0); break;
       case 'F': return (uppercase ? (CPP_N_DFLOAT | CPP_N_SMALL) : 0); break;
-      case 'd': return (!uppercase ? (CPP_N_DFLOAT | CPP_N_MEDIUM): 0); break;
+      case 'd': return (!uppercase ? (CPP_N_DFLOAT | CPP_N_MEDIUM) : 0); break;
       case 'D': return (uppercase ? (CPP_N_DFLOAT | CPP_N_MEDIUM) : 0); break;
       case 'l': return (!uppercase ? (CPP_N_DFLOAT | CPP_N_LARGE) : 0); break;
       case 'L': return (uppercase ? (CPP_N_DFLOAT | CPP_N_LARGE) : 0); break;
-- 
GitLab