cpluspluscheck complains about use of register

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: pgsql-hackers@postgresql.org
Date: 2022-03-08T18:18:37Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove uses of register due to incompatibility with C++17 and up

Hi,

When running cpluspluscheck I get many many complaints like

In file included from /tmp/pg-test-repo/src/include/port/atomics.h:70,
                 from /tmp/pg-test-repo/src/include/utils/dsa.h:17,
                 from /tmp/pg-test-repo/src/include/nodes/tidbitmap.h:26,
                 from /tmp/pg-test-repo/src/include/nodes/execnodes.h:24,
                 from /tmp/pg-test-repo/src/include/commands/trigger.h:17,
                 from /tmp/pg-test-repo/src/pl/plpgsql/src/plpgsql.h:21,
                 from /tmp/cpluspluscheck.qOi18T/test.cpp:3:
/tmp/pg-test-repo/src/include/port/atomics/arch-x86.h: In function ‘bool pg_atomic_test_set_flag_impl(volatile pg_atomic_flag*)’:
/tmp/pg-test-repo/src/include/port/atomics/arch-x86.h:143:23: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  143 |         register char _res = 1;
      |                       ^~~~

It seems we should just remove the use of register? It's currently only used
in
src/include/storage/s_lock.h
src/include/port/atomics/arch-x86.h

From what I understand compilers essentially have been ignoring it for quite a
while...

Greetings,

Andres Freund