Use __typeof__ instead of typeof
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 20 Jan 2022 14:32:56 +0000 (09:32 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 28 Jan 2022 16:22:26 +0000 (11:22 -0500)
commit0ec1ae8bf5f4cad3f4b90f2615909c3e7bc6270d
tree446f814545b4bee6c089e68e5a8dea8c2743d957
parent9fe8008636e7971b7e83e888dddae11b1244ef30
Use __typeof__ instead of typeof

When compiling the ctf plugin as C++, a common error was:

    In file included from /home/simark/src/babeltrace/src/plugins/ctf/common/bfcr/bfcr.cpp:23:
    /home/simark/src/babeltrace/src/plugins/ctf/common/bfcr/bfcr.cpp: In function ‘void read_unsigned_bitfield(bt_bfcr*, const uint8_t*, size_t, unsigned int, ctf_byte_order, uint64_t*)’:
    /home/simark/src/babeltrace/src/compat/bitfield.h:343:9: error: ‘typeof’ was not declared in this scope
      343 |         typeof(*(vptr)) *_vptr = (vptr);                                \
          |         ^~~~~~

Use __typeof__ instead, gcc and clang seem happy with that in both C and
C++.  Using `decltype` or `auto` would be more C++-y, but using
__typeof__ works and we don't need separate paths for both languages.

Change-Id: Iec503420f27dd2fe0a246d02af9380a2cff1c96e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7098
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/common/align.h
src/common/list.h
src/common/macros.h
src/compat/compiler.h
This page took 0.024872 seconds and 4 git commands to generate.