public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Define __riscv_cmodel_medany for PIC mode.
@ 2020-09-25  5:46 Kito Cheng
  2020-09-28 19:34 ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Kito Cheng @ 2020-09-25  5:46 UTC (permalink / raw)
  To: gcc-patches, kito.cheng, jimw; +Cc: Kito Cheng

 - According the conclusion in RISC-V C API document, we decide to deprecat
   the __riscv_cmodel_pic marco

 - __riscv_cmodel_pic is deprecated and will removed in next GCC
   release.

[1] https://github.com/riscv/riscv-c-api-doc/pull/11
---
 gcc/config/riscv/riscv-c.c                | 7 ++++---
 gcc/testsuite/gcc.target/riscv/predef-3.c | 6 +++---
 gcc/testsuite/gcc.target/riscv/predef-6.c | 6 +++---
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/gcc/config/riscv/riscv-c.c b/gcc/config/riscv/riscv-c.c
index 735f2f2f513f..9221fcbaca5d 100644
--- a/gcc/config/riscv/riscv-c.c
+++ b/gcc/config/riscv/riscv-c.c
@@ -90,12 +90,13 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile)
       builtin_define ("__riscv_cmodel_medlow");
       break;
 
+    case CM_PIC:
+      builtin_define ("__riscv_cmodel_pic");
+      /* FALLTHROUGH. */
+
     case CM_MEDANY:
       builtin_define ("__riscv_cmodel_medany");
       break;
 
-    case CM_PIC:
-      builtin_define ("__riscv_cmodel_pic");
-      break;
     }
 }
diff --git a/gcc/testsuite/gcc.target/riscv/predef-3.c b/gcc/testsuite/gcc.target/riscv/predef-3.c
index 6f4f2e219941..d7c9793b3d7c 100644
--- a/gcc/testsuite/gcc.target/riscv/predef-3.c
+++ b/gcc/testsuite/gcc.target/riscv/predef-3.c
@@ -55,11 +55,11 @@ int main () {
 #if defined(__riscv_cmodel_medlow)
 #error "__riscv_cmodel_medlow"
 #endif
-#if defined(__riscv_cmodel_medany)
-#error "__riscv_cmodel_medlow"
+#if !defined(__riscv_cmodel_medany)
+#error "__riscv_cmodel_medany"
 #endif
 #if !defined(__riscv_cmodel_pic)
-#error "__riscv_cmodel_medlow"
+#error "__riscv_cmodel_pic"
 #endif
 
   return 0;
diff --git a/gcc/testsuite/gcc.target/riscv/predef-6.c b/gcc/testsuite/gcc.target/riscv/predef-6.c
index ee4e02bcb63e..7530f9598aeb 100644
--- a/gcc/testsuite/gcc.target/riscv/predef-6.c
+++ b/gcc/testsuite/gcc.target/riscv/predef-6.c
@@ -55,11 +55,11 @@ int main () {
 #if defined(__riscv_cmodel_medlow)
 #error "__riscv_cmodel_medlow"
 #endif
-#if defined(__riscv_cmodel_medany)
-#error "__riscv_cmodel_medlow"
+#if !defined(__riscv_cmodel_medany)
+#error "__riscv_cmodel_medany"
 #endif
 #if !defined(__riscv_cmodel_pic)
-#error "__riscv_cmodel_medlow"
+#error "__riscv_cmodel_medpic"
 #endif
 
   return 0;
-- 
2.28.0


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

* Re: [PATCH] RISC-V: Define __riscv_cmodel_medany for PIC mode.
  2020-09-25  5:46 [PATCH] RISC-V: Define __riscv_cmodel_medany for PIC mode Kito Cheng
@ 2020-09-28 19:34 ` Jim Wilson
  2020-09-29  9:01   ` Kito Cheng
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2020-09-28 19:34 UTC (permalink / raw)
  To: Kito Cheng; +Cc: GCC Patches, Kito Cheng

On Thu, Sep 24, 2020 at 10:46 PM Kito Cheng <kito.cheng@sifive.com> wrote:
>
>  - According the conclusion in RISC-V C API document, we decide to deprecat
>    the __riscv_cmodel_pic marco
>
>  - __riscv_cmodel_pic is deprecated and will removed in next GCC
>    release.

Looks good to me.  By the way, you can self approve patches like this.

Optionally, you might add a comment to the code to point out that
__riscv_cmodel_pic is deprecated.  That makes it a little easier to
understand the code.

Jim

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

* Re: [PATCH] RISC-V: Define __riscv_cmodel_medany for PIC mode.
  2020-09-28 19:34 ` Jim Wilson
@ 2020-09-29  9:01   ` Kito Cheng
  0 siblings, 0 replies; 3+ messages in thread
From: Kito Cheng @ 2020-09-29  9:01 UTC (permalink / raw)
  To: Jim Wilson; +Cc: Kito Cheng, GCC Patches

Thanks, committed with more comments in code :)

On Tue, Sep 29, 2020 at 3:35 AM Jim Wilson <jimw@sifive.com> wrote:
>
> On Thu, Sep 24, 2020 at 10:46 PM Kito Cheng <kito.cheng@sifive.com> wrote:
> >
> >  - According the conclusion in RISC-V C API document, we decide to deprecat
> >    the __riscv_cmodel_pic marco
> >
> >  - __riscv_cmodel_pic is deprecated and will removed in next GCC
> >    release.
>
> Looks good to me.  By the way, you can self approve patches like this.
>
> Optionally, you might add a comment to the code to point out that
> __riscv_cmodel_pic is deprecated.  That makes it a little easier to
> understand the code.
>
> Jim

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

end of thread, other threads:[~2020-09-29  9:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25  5:46 [PATCH] RISC-V: Define __riscv_cmodel_medany for PIC mode Kito Cheng
2020-09-28 19:34 ` Jim Wilson
2020-09-29  9:01   ` Kito Cheng

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