public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kaz Kojima <kkojima@rr.iij4u.or.jp>
To: gcc-patches@gcc.gnu.org
Subject: [patch committed SH] Fix build failure
Date: Wed, 07 Sep 2016 06:26:00 -0000	[thread overview]
Message-ID: <20160907.134643.288067910.kkojima@rr.iij4u.or.jp> (raw)

I've committed the attached patch to fix build failure on SH
during compiling tree-profile.c:

../trunk/gcc/tree-profile.c: In function 'unsigned int tree_profiling()':
../trunk/gcc/tree-profile.c:560:12: error: 'TARGET_ATOMIC_ANY' was not declared in this scope

The target sets HAVE_atomic_compare_and_swapsi to TARGET_ATOMIC_ANY
defined in sh-protos.h which can't be seen from tree-profile.c.
The patch simply moves definitions for atomic models to sh.h from
sh-protos.h and guard them with __cplusplus.

Regards,
	kaz
--
2016-09-07  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/sh-protos.h (struct sh_atomic_model,
	selected_atomic_model, TARGET_ATOMIC_ANY, TARGET_ATOMIC_STRICT,
	TARGET_ATOMIC_SOFT_GUSA, TARGET_ATOMIC_HARD_LLCS,
	TARGET_ATOMIC_SOFT_TCB, TARGET_ATOMIC_SOFT_IMASK): Move to...
	* config/sh/sh.h (struct sh_atomic_model,
	selected_atomic_model, TARGET_ATOMIC_ANY, TARGET_ATOMIC_STRICT,
	TARGET_ATOMIC_SOFT_GUSA, TARGET_ATOMIC_HARD_LLCS,
	TARGET_ATOMIC_SOFT_TCB, TARGET_ATOMIC_SOFT_IMASK): ...here.
	Guard with __cplusplus.

diff --git a/config/sh/sh-protos.h b/config/sh/sh-protos.h
index fecbb88..f611dab 100644
--- a/config/sh/sh-protos.h
+++ b/config/sh/sh-protos.h
@@ -35,59 +35,6 @@ enum sh_function_kind {
   SFUNC_STATIC
 };
 
-/* Atomic model.  */
-struct sh_atomic_model
-{
-  enum enum_type
-  {
-    none = 0,
-    soft_gusa,
-    hard_llcs,
-    soft_tcb,
-    soft_imask,
-
-    num_models
-  };
-
-  /*  If strict is set, disallow mixing of different models, as it would
-      happen on SH4A.  */
-  bool strict;
-  enum_type type;
-
-  /* Name string as it was specified on the command line.  */
-  const char* name;
-
-  /* Name string as it is used in C/C++ defines.  */
-  const char* cdef_name;
-
-  /* GBR offset variable for TCB model.  */
-  int tcb_gbr_offset;
-};
-
-extern const sh_atomic_model& selected_atomic_model (void);
-
-/* Shortcuts to check the currently selected atomic model.  */
-#define TARGET_ATOMIC_ANY \
-  (selected_atomic_model ().type != sh_atomic_model::none)
-
-#define TARGET_ATOMIC_STRICT \
-  (selected_atomic_model ().strict)
-
-#define TARGET_ATOMIC_SOFT_GUSA \
-  (selected_atomic_model ().type == sh_atomic_model::soft_gusa)
-
-#define TARGET_ATOMIC_HARD_LLCS \
-  (selected_atomic_model ().type == sh_atomic_model::hard_llcs)
-
-#define TARGET_ATOMIC_SOFT_TCB \
-  (selected_atomic_model ().type == sh_atomic_model::soft_tcb)
-
-#define TARGET_ATOMIC_SOFT_TCB_GBR_OFFSET_RTX \
-  GEN_INT (selected_atomic_model ().tcb_gbr_offset)
-
-#define TARGET_ATOMIC_SOFT_IMASK \
-  (selected_atomic_model ().type == sh_atomic_model::soft_imask)
-
 #ifdef RTX_CODE
 extern rtx sh_fsca_sf2int (void);
 extern rtx sh_fsca_int2sf (void);
diff --git a/config/sh/sh.h b/config/sh/sh.h
index 0403616..25b6cee 100644
--- a/config/sh/sh.h
+++ b/config/sh/sh.h
@@ -333,6 +333,63 @@ extern enum sh_divide_strategy_e sh_div_strategy;
 #define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL_DIV1
 #endif
 
+#ifdef __cplusplus
+
+/* Atomic model.  */
+struct sh_atomic_model
+{
+  enum enum_type
+  {
+    none = 0,
+    soft_gusa,
+    hard_llcs,
+    soft_tcb,
+    soft_imask,
+
+    num_models
+  };
+
+  /*  If strict is set, disallow mixing of different models, as it would
+      happen on SH4A.  */
+  bool strict;
+  enum_type type;
+
+  /* Name string as it was specified on the command line.  */
+  const char* name;
+
+  /* Name string as it is used in C/C++ defines.  */
+  const char* cdef_name;
+
+  /* GBR offset variable for TCB model.  */
+  int tcb_gbr_offset;
+};
+
+extern const sh_atomic_model& selected_atomic_model (void);
+
+/* Shortcuts to check the currently selected atomic model.  */
+#define TARGET_ATOMIC_ANY \
+  (selected_atomic_model ().type != sh_atomic_model::none)
+
+#define TARGET_ATOMIC_STRICT \
+  (selected_atomic_model ().strict)
+
+#define TARGET_ATOMIC_SOFT_GUSA \
+  (selected_atomic_model ().type == sh_atomic_model::soft_gusa)
+
+#define TARGET_ATOMIC_HARD_LLCS \
+  (selected_atomic_model ().type == sh_atomic_model::hard_llcs)
+
+#define TARGET_ATOMIC_SOFT_TCB \
+  (selected_atomic_model ().type == sh_atomic_model::soft_tcb)
+
+#define TARGET_ATOMIC_SOFT_TCB_GBR_OFFSET_RTX \
+  GEN_INT (selected_atomic_model ().tcb_gbr_offset)
+
+#define TARGET_ATOMIC_SOFT_IMASK \
+  (selected_atomic_model ().type == sh_atomic_model::soft_imask)
+
+#endif // __cplusplus
+
 #define SUBTARGET_OVERRIDE_OPTIONS (void) 0
 
 \f

             reply	other threads:[~2016-09-07  4:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07  6:26 Kaz Kojima [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-12-07  0:03 Kaz Kojima
2015-09-17  8:12 Kaz Kojima
2007-03-10  7:47 [patch committed] SH: " Kaz Kojima

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=20160907.134643.288067910.kkojima@rr.iij4u.or.jp \
    --to=kkojima@rr.iij4u.or.jp \
    --cc=gcc-patches@gcc.gnu.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).