summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-01-03 23:04:52 +0100
committerTyge Løvset <[email protected]>2022-01-03 23:04:52 +0100
commitd37056f1ef380a5649e192436e84a15d1520c5e0 (patch)
tree7814b6b0c76163ca4e37303cfbe2a4941039fefa /examples
parentc935d2af7cf730fec80695d20529d0b15bda2898 (diff)
downloadSTC-modified-d37056f1ef380a5649e192436e84a15d1520c5e0.tar.gz
STC-modified-d37056f1ef380a5649e192436e84a15d1520c5e0.zip
"gcc/clang -O2 -Wall -std=c99 -pedantic" compiles examples with no warnings. More cleanups.
Diffstat (limited to 'examples')
-rw-r--r--examples/complex.c2
-rw-r--r--examples/csset_erase.c3
-rw-r--r--examples/list.c2
-rw-r--r--examples/phonebook.c7
-rw-r--r--examples/replace.c1
-rw-r--r--examples/runall.sh2
6 files changed, 7 insertions, 10 deletions
diff --git a/examples/complex.c b/examples/complex.c
index 747cec07..b0cd7a01 100644
--- a/examples/complex.c
+++ b/examples/complex.c
@@ -30,7 +30,7 @@ void check_drop(float* v) {printf("destroy %g\n", *v);}
int main() {
int xdim = 4, ydim = 6;
- int x = 1, y = 3, tableKey = 42;
+ int x = 1, tableKey = 42;
const char* strKey = "first";
c_auto (MapMap, mmap)
diff --git a/examples/csset_erase.c b/examples/csset_erase.c
index 485e78de..fe9977a9 100644
--- a/examples/csset_erase.c
+++ b/examples/csset_erase.c
@@ -19,7 +19,8 @@ int main()
it = csset_int_lower_bound(&set, val);
c_foreach (k, csset_int, it, csset_int_end(&set))
- printf(" %d", *k.ref); puts("");
+ printf(" %d", *k.ref);
+ puts("");
printf("Erase values >= %d:\n", val);
while (it.ref != csset_int_end(&set).ref)
diff --git a/examples/list.c b/examples/list.c
index 4d177b3b..cbf282a5 100644
--- a/examples/list.c
+++ b/examples/list.c
@@ -40,7 +40,7 @@ int main() {
c_foreach (i, clist_fx, list) printf(" %g", *i.ref);
puts("");
- int removed = clist_fx_remove(&list, 30);
+ clist_fx_remove(&list, 30);
clist_fx_insert(&list, clist_fx_begin(&list), 5); // same as push_front()
clist_fx_push_back(&list, 500);
clist_fx_push_front(&list, 1964);
diff --git a/examples/phonebook.c b/examples/phonebook.c
index eeb1d3b8..fff84bec 100644
--- a/examples/phonebook.c
+++ b/examples/phonebook.c
@@ -39,8 +39,6 @@ void print_phone_book(cmap_str phone_book)
int main(int argc, char **argv)
{
- c_static_assert(sizeof argc == 4);
-
c_auto (cset_str, names) {
c_apply(v, cset_str_emplace(&names, v), const char*,
{"Hello", "Cool", "True"});
@@ -48,7 +46,6 @@ int main(int argc, char **argv)
puts("");
}
- bool erased;
c_auto (cmap_str, phone_book) {
c_apply(v, cmap_str_emplace(&phone_book, c_pair(v)), cmap_str_raw, {
{"Lilia Friedman", "(892) 670-4739"},
@@ -69,8 +66,8 @@ int main(int argc, char **argv)
if (cmap_str_contains(&phone_book, "Tariq Beltran"))
printf("\nTariq Beltran is in phone book\n");
- erased = cmap_str_erase(&phone_book, "Tariq Beltran");
- erased = cmap_str_erase(&phone_book, "Elliott Mooney");
+ cmap_str_erase(&phone_book, "Tariq Beltran");
+ cmap_str_erase(&phone_book, "Elliott Mooney");
printf("\nPhone book after erasing Tariq and Elliott:\n");
print_phone_book(phone_book);
diff --git a/examples/replace.c b/examples/replace.c
index 0349d9f4..bc28cb2a 100644
--- a/examples/replace.c
+++ b/examples/replace.c
@@ -6,7 +6,6 @@ int main ()
const char *base = "this is a test string.";
const char *s2 = "n example";
const char *s3 = "sample phrase";
- const char *s4 = "useful.";
// replace signatures used in the same order as described above:
diff --git a/examples/runall.sh b/examples/runall.sh
index e95068ff..3c6e3ec9 100644
--- a/examples/runall.sh
+++ b/examples/runall.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-cc='gcc -std=c99 -pedantic'
+cc='clang -O2 -Wall -std=c99 -pedantic'
#cc='clang'
#cc='clang -c -DSTC_HEADER'
#cc='cl -nologo'