Re: [lttng-dev] [PATCH 02/11] urcu/uatomic: Use atomic builtins if configured

Olivier Dion via lttng-dev <[email protected]>
Newsgroups org.lttng.lists.lttng-dev
Organization EfficiOS
Message-ID <878rc2ji9z.fsf@laura>
On Thu, 22 Jun 2023, "Paul E. McKenney" <[email protected]> wrote:
> On Thu, Jun 22, 2023 at 11:55:55AM -0400, Mathieu Desnoyers wrote:
>> On 6/21/23 19:19, Paul E. McKenney wrote:
> I suggest C11 volatile atomic load/store.  Load/store fusing is permitted
> for non-volatile atomic loads and stores, and such fusing can ruin your
> code's entire day.  ;-)

After some testing, I got a wall of warnings:

  -Wignored-qualifiers:

    Warn if the return type of a function has a type qualifier such as
    "const".  For ISO C such a type qualifier has no effect, since the
    value returned by a function is not an lvalue.  For C++, the warning
    is only emitted for scalar types or "void".  ISO C prohibits
    qualified "void" return types on function definitions, so such
    return types always receive a warning even without this option.

Since we are using atomic builtins, for example load:

  type __atomic_load_n (type *ptr, int memorder)

If we put the qualifier volatile to TYPE, we end up with the same
qualifier on the return value, triggering a warning for each atomic
operation.

This seems to be only a problem when compiling in C++ [0] while in C it
seems the compiler is more relaxed on this [1].

Ideas to make the toolchains happy? :-)

  [0] https://godbolt.org/z/3nW14M3v1
  [1] https://godbolt.org/z/TcTeMeKbW

-- 
Olivier Dion
EfficiOS Inc.
https://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.