# zig.h: Add some casts to \_\_atomic macros to shut Clang warnings up\. · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/aa37a5a0c4e5a74aebc029c6513f762da2208658)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: aa37a5a0c4e5a74aebc029c6513f762da2208658

Requested commit: aa37a5a0c4e5a74aebc029c6513f762da2208658

Commit: aa37a5a0c4e5a74aebc029c6513f762da2208658

Tree: cf8da9dd0f7057b2c121857908e725aedec90a54

Author: Alex Rønne Petersen

Committer: Alex Rønne Petersen

## Message

```
zig.h: Add some casts to __atomic macros to shut Clang warnings up.

This is a stupid Clang-ism:

    ❯ cat test.c
    int main() {
        int value = 42;
        int const *value_ptr = &value;
        int location;
        __atomic_store(&location, value_ptr, __ATOMIC_SEQ_CST);
    }
    ❯ gcc test.c -fsyntax-only
    ❯ clang test.c -fsyntax-only
    test.c:5:31: warning: passing 'const int *' to parameter of type 'int *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        5 |     __atomic_store(&location, value_ptr, __ATOMIC_SEQ_CST);
          |                               ^~~~~~~~~
    1 warning generated.

I have no idea why Clang doesn't define these builtins as taking const pointers
for the parameters that are only read from. Anyway, after the next zig1.wasm
update, this change should shut up these warnings that we've been seeing in CI
during bootstrap for ages.

```

## Parents

- [183bb8b08403ab594cdc543c2db2503e7eac0052](https://git.cafe/gitcafe/zig/commit/183bb8b08403ab594cdc543c2db2503e7eac0052?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/aa37a5a0c4e5a74aebc029c6513f762da2208658?format=markdown)
