This is an automated email from the ASF dual-hosted git repository.

yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 95831e24f51e248341865f7934b92c76a44df43c
Author: Andres Freund <[email protected]>
AuthorDate: Sat Sep 24 12:01:06 2022 -0700

    Remove uses of register due to incompatibility with C++17 and up
    
    The use in regexec.c could remain, since we only try to keep headers C++
    clean. But there really doesn't seem to be a good reason to use register in
    that spot.
    
    Discussion: 
https://postgr.es/m/[email protected]
    (cherry picked from commit 03bf971d2dc701d473705fd00891028d140dd5ae)
---
 src/backend/regex/regexec.c         |  2 +-
 src/include/port/atomics/arch-x86.h |  2 +-
 src/include/storage/s_lock.h        | 14 +++++++-------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/backend/regex/regexec.c b/src/backend/regex/regexec.c
index e72aa8ccfb..b743b6a05f 100644
--- a/src/backend/regex/regexec.c
+++ b/src/backend/regex/regexec.c
@@ -183,7 +183,7 @@ pg_regexec(regex_t *re,
                   int flags)
 {
        struct vars var;
-       register struct vars *v = &var;
+       struct vars *v = &var;
        int                     st;
        size_t          n;
        size_t          i;
diff --git a/src/include/port/atomics/arch-x86.h 
b/src/include/port/atomics/arch-x86.h
index 2cab5a327a..08c0f46271 100644
--- a/src/include/port/atomics/arch-x86.h
+++ b/src/include/port/atomics/arch-x86.h
@@ -140,7 +140,7 @@ pg_spin_delay_impl(void)
 static inline bool
 pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
 {
-       register char _res = 1;
+       char            _res = 1;
 
        __asm__ __volatile__(
                "       lock                    \n"
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 940d739c3f..157cfe2da7 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -142,7 +142,7 @@ typedef unsigned char slock_t;
 static __inline__ int
 tas(volatile slock_t *lock)
 {
-       register slock_t _res = 1;
+       slock_t         _res = 1;
 
        /*
         * Use a non-locking test before asserting the bus lock.  Note that the
@@ -223,7 +223,7 @@ typedef unsigned char slock_t;
 static __inline__ int
 tas(volatile slock_t *lock)
 {
-       register slock_t _res = 1;
+       slock_t         _res = 1;
 
        __asm__ __volatile__(
                "       lock                    \n"
@@ -404,7 +404,7 @@ typedef unsigned char slock_t;
 static __inline__ int
 tas(volatile slock_t *lock)
 {
-       register slock_t _res;
+       slock_t         _res;
 
        /*
         *      See comment in src/backend/port/tas/sunstudio_sparc.s for why 
this
@@ -673,9 +673,9 @@ typedef unsigned int slock_t;
 static __inline__ int
 tas(volatile slock_t *lock)
 {
-       register volatile slock_t *_l = lock;
-       register int _res;
-       register int _tmp;
+       volatile slock_t *_l = lock;
+       int                     _res;
+       int                     _tmp;
 
        __asm__ __volatile__(
                "       .set push           \n"
@@ -820,7 +820,7 @@ static __inline__ int
 tas(volatile slock_t *lock)
 {
        volatile int *lockword = TAS_ACTIVE_WORD(lock);
-       register int lockval;
+       int                     lockval;
 
        __asm__ __volatile__(
                "       ldcwx   0(0,%2),%0      \n"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to