Skip to content

Commit b36ed81

Browse files
authored
Fix MacOS warning (function declaration without prototype) (#12)
* Fix MacOS warning (function declaration without prototype) pcg_basic.c.o -c ../subprojects/deckhandler/subprojects/pcg/pcg_basic.c ../subprojects/deckhandler/subprojects/pcg/pcg_basic.c:69:22: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] uint32_t pcg32_random() * CI: Add MacOS * CI: Add -Werror flag * docs: Add MacOS CI badge
1 parent 19c46a1 commit b36ed81

File tree

5 files changed

+50
-7
lines changed

5 files changed

+50
-7
lines changed

.github/workflows/linux.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: C/C++ CI
1+
name: Linux
22
concurrency:
33
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
44
cancel-in-progress: true
@@ -35,7 +35,7 @@ jobs:
3535
python3-dev
3636
3737
- name: Meson setup
38-
run: meson setup _build -Db_sanitize=address,undefined
38+
run: CFLAGS="-Werror" meson setup _build -Db_sanitize=address,undefined
3939

4040
- name: Build
4141
run: meson compile -C _build
@@ -45,7 +45,8 @@ jobs:
4545
cd _build
4646
meson test -v
4747
48-
- name: Test swig
48+
- name: Test swig build
4949
run: |
50-
meson setup _build --reconfigure -Dswig_lang=python
50+
rm -rf _build
51+
meson setup _build -Dswig_lang=python
5152
meson compile -C _build

.github/workflows/macos.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: MacOS
2+
concurrency:
3+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
4+
cancel-in-progress: true
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
paths:
10+
- '**'
11+
- '!**.yml'
12+
- '!**.md'
13+
- '**/macos.yml'
14+
15+
pull_request:
16+
branches: [ master ]
17+
paths:
18+
- '**'
19+
- '!**.yml'
20+
- '!**.md'
21+
- '**/macos.yml'
22+
23+
jobs:
24+
MacOS:
25+
runs-on: macos-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Install Dependencies
29+
run: |
30+
brew update
31+
brew install \
32+
meson
33+
34+
- name: Meson setup
35+
run: CFLAGS="-Werror" meson setup _build -Db_sanitize=address,undefined
36+
37+
- name: Build
38+
run: meson compile -C _build
39+
40+
- name: Test
41+
run: meson test -v -C _build

.github/workflows/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Meson setup
3838
shell: msys2 {0}
3939
run: |
40-
meson setup _build
40+
CFLAGS="-Werror" meson setup _build
4141
4242
- name: Build
4343
shell: msys2 {0}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Linux](https://github.com/theimpossibleastronaut/deckhandler/actions/workflows/linux.yml/badge.svg)](https://github.com/theimpossibleastronaut/deckhandler/actions/workflows/linux.yml)
22
[![Windows](https://github.com/theimpossibleastronaut/deckhandler/actions/workflows/windows.yml/badge.svg)](https://github.com/theimpossibleastronaut/deckhandler/actions/workflows/windows.yml)
3+
[![MacOS](https://github.com/Dealer-s-Choice/deckhandler/actions/workflows/macos.yml/badge.svg)](https://github.com/Dealer-s-Choice/deckhandler/actions/workflows/macos.yml)
34

45
# deckhandler
56
Library that will create a deck of cards and shuffle it.

subprojects/pcg/pcg_basic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ uint32_t pcg32_random_r(pcg32_random_t* rng)
6666
return (xorshifted >> rot) | (xorshifted << ((-rot) & 31));
6767
}
6868

69-
uint32_t pcg32_random()
69+
uint32_t pcg32_random(void)
7070
{
7171
return pcg32_random_r(&pcg32_global);
7272
}
@@ -98,7 +98,7 @@ uint32_t pcg32_boundedrand_r(pcg32_random_t* rng, uint32_t bound)
9898
// should usually terminate quickly; on average (assuming all bounds are
9999
// equally likely), 82.25% of the time, we can expect it to require just
100100
// one iteration. In the worst case, someone passes a bound of 2^31 + 1
101-
// (i.e., 2147483649), which invalidates almost 50% of the range. In
101+
// (i.e., 2147483649), which invalidates almost 50% of the range. In
102102
// practice, bounds are typically small and only a tiny amount of the range
103103
// is eliminated.
104104
for (;;) {

0 commit comments

Comments
 (0)