diff mbox series

RISC-V: Define __riscv_cmodel_medany for PIC mode.

Message ID 20200925054604.97066-1-kito.cheng@sifive.com
State New
Headers show
Series RISC-V: Define __riscv_cmodel_medany for PIC mode. | expand

Commit Message

Kito Cheng Sept. 25, 2020, 5:46 a.m. UTC
- 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(-)

Comments

Jim Wilson Sept. 28, 2020, 7:34 p.m. UTC | #1
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
Kito Cheng Sept. 29, 2020, 9:01 a.m. UTC | #2
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
diff mbox series

Patch

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;