Skip to content

Commit 2f52a9a

Browse files
committed
Switched C standard from gnu89 to C11 for improved compatibility, modern features, and better code maintainability.
1 parent d546530 commit 2f52a9a

File tree

9 files changed

+68
-67
lines changed

9 files changed

+68
-67
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Changelog
33

44
v3.4.0
55
------
6+
- Switched C standard from `gnu89` to `C11` for improved compatibility, modern features, and better code maintainability.
67
- Setting `-flto=auto` in makefiles for better compiling performance
78
- Modified the `check-build` and `validate` workflow triggers from 'main' branch only to all branches except `gh-pages` branch.
89

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ codecov:
1414
make $(ARCH) D_ARGS="-DDEBUG -ftest-coverage -fprofile-arcs --coverage -O0"
1515

1616
x86_64:
17-
make -f Makefile.generic -j $(NPROC) COMPILER=$(CC) LDLIBS='$(LIBS)' CFLAGS='-Wall -std=gnu89 -Ofast -fPIC -flto=auto -ftree-vectorize -finline-functions -march=native -mtune=native'
17+
make -f Makefile.generic -j $(NPROC) COMPILER=$(CC) LDLIBS='$(LIBS)' CFLAGS='-Wall -std=c11 -Ofast -fPIC -flto=auto -ftree-vectorize -finline-functions -march=native -mtune=native -D_XOPEN_SOURCE=700'
1818

1919
icx:
20-
make -f Makefile.generic -j $(NPROC) COMPILER=icx LDLIBS='$(LIBS)' CFLAGS='-Wall -std=gnu89 -O3 -fPIC -ftree-vectorize -finline-functions -march=native -mtune=native'
20+
make -f Makefile.generic -j $(NPROC) COMPILER=icx LDLIBS='$(LIBS)' CFLAGS='-Wall -std=c11 -O3 -fPIC -ftree-vectorize -finline-functions -march=native -mtune=native -D_XOPEN_SOURCE=700'
2121

2222
clang:
23-
make -f Makefile.generic -j $(NPROC) COMPILER=clang AR=$(CLANG_AR) LDLIBS='$(LIBS)' CFLAGS='-Wall -std=gnu89 -Ofast -fPIC -ftree-vectorize -finline-functions -march=native -mtune=native'
23+
make -f Makefile.generic -j $(NPROC) COMPILER=clang AR=$(CLANG_AR) LDLIBS='$(LIBS)' CFLAGS='-Wall -std=c11 -Ofast -fPIC -ftree-vectorize -finline-functions -march=native -mtune=native -D_XOPEN_SOURCE=700'
2424

2525
unknown:
26-
make -f Makefile.generic -j $(NPROC) COMPILER=$(CC) LDLIBS='$(LIBS)' CFLAGS='-std=gnu89 -Ofast -fPIC -flto=auto'
26+
make -f Makefile.generic -j $(NPROC) COMPILER=$(CC) LDLIBS='$(LIBS)' CFLAGS='-std=c11 -Ofast -fPIC -flto=auto -D_XOPEN_SOURCE=700'
2727

2828
clean:
2929
make -f Makefile.generic clean

libconcurrent/includes/barrier.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ typedef struct SynchBarrier {
2929
///
3030
/// @param bar A pointer to an instance of the barrier object.
3131
/// @param n The number of threads that will use the barrier object.
32-
inline void synchBarrierSet(SynchBarrier *bar, uint32_t n);
32+
void synchBarrierSet(SynchBarrier *bar, uint32_t n);
3333

3434
/// @brief Whenever a thread executes this function, it waits without returning
3535
/// until all the other n-1 threads also execute the same function.
3636
/// @param bar A pointer to an instance of the barrier object.
37-
inline void synchBarrierWait(SynchBarrier *bar);
37+
void synchBarrierWait(SynchBarrier *bar);
3838

3939
/// @brief Whenever a thread executes this function, it states that it will no use this barrier instance anymore.
4040
/// Thus, the system may free some resources.
4141
/// @param bar A pointer to an instance of the barrier object.
42-
inline void synchBarrierLeave(SynchBarrier *bar);
42+
void synchBarrierLeave(SynchBarrier *bar);
4343

4444
/// @brief Deprecated functionality. It is only used in the threadtools.c file.
4545
/// @param bar A pointer to an instance of the barrier object.
46-
inline void synchBarrierLastLeave(SynchBarrier *bar);
46+
void synchBarrierLastLeave(SynchBarrier *bar);
4747

4848
#endif

libconcurrent/includes/clhhash.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ typedef struct CLHHashThreadState {
7474
/// @param hash A pointer to the hash-table instance.
7575
/// @param num_cells The number of cells that the hash-table object is going to use.
7676
/// @param nthreads The number of threads that will use the CLH-Hash object.
77-
inline void CLHHashStructInit(CLHHash *hash, int num_cells, int nthreads);
77+
void CLHHashStructInit(CLHHash *hash, int num_cells, int nthreads);
7878

7979
/// @brief This function should be called once before the thread applies any operation to the CLH-Hash combining object.
8080
///
8181
/// @param hash A pointer to the hash-table instance.
8282
/// @param th_state A pointer to thread's local state of CLH-Hash.
8383
/// @param num_cells The number of cells that the hash-table object is going to use.
8484
/// @param pid The pid of the calling thread.
85-
inline void CLHHashThreadStateInit(CLHHash *hash, CLHHashThreadState *th_state, int num_cells, int pid);
85+
void CLHHashThreadStateInit(CLHHash *hash, CLHHashThreadState *th_state, int num_cells, int pid);
8686

8787
/// @brief This function tries to insert a <key,value> into the hash-table if there is enough space in the
8888
/// corresponding cell. If the key already exists in the hash-table, CLHHashInsert updates the corresponding value.
@@ -93,7 +93,7 @@ inline void CLHHashThreadStateInit(CLHHash *hash, CLHHashThreadState *th_state,
9393
/// @param value The value of the <key,value> pair that CLHHashInsert will try to insert into the hash-table.
9494
/// @param pid The pid of the calling thread.
9595
/// @return In case of success true is returned. In case that there is not enough space in the corresponding cell.
96-
inline bool CLHHashInsert(CLHHash *hash, CLHHashThreadState *th_state, int64_t key, int64_t value, int pid);
96+
bool CLHHashInsert(CLHHash *hash, CLHHashThreadState *th_state, int64_t key, int64_t value, int pid);
9797

9898
/// @brief This function searches for a specific key in the hash-table. In case that CLHHashSearch finds the key,
9999
/// it returns true. Otherwise, it returns false.
@@ -103,7 +103,7 @@ inline bool CLHHashInsert(CLHHash *hash, CLHHashThreadState *th_state, int64_t k
103103
/// @param key The key of the <key,value> pair that CLHHashSearch will search for.
104104
/// @param pid The pid of the calling thread.
105105
/// @return CLHHashSearch returns the value of the <key,value> pair in case that the key exists in the hash-table.
106-
inline RetVal CLHHashSearch(CLHHash *hash, CLHHashThreadState *th_state, int64_t key, int pid);
106+
RetVal CLHHashSearch(CLHHash *hash, CLHHashThreadState *th_state, int64_t key, int pid);
107107

108108
/// @brief This function searches for a specific key in the hash-table. In case that CLHHashDelete finds the key,
109109
/// it deletes the corresponding <key,value>.
@@ -112,6 +112,6 @@ inline RetVal CLHHashSearch(CLHHash *hash, CLHHashThreadState *th_state, int64_t
112112
/// @param th_state A pointer to thread's local state of CLH-Hash.
113113
/// @param key The key of the <key,value> pair that CLHHashDelete will try to delete it.
114114
/// @param pid The pid of the calling thread.
115-
inline void CLHHashDelete(CLHHash *hash, CLHHashThreadState *th_state, int64_t key, int pid);
115+
void CLHHashDelete(CLHHash *hash, CLHHashThreadState *th_state, int64_t key, int pid);
116116

117117
#endif

libconcurrent/includes/dsmhash.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ typedef struct DSMHashThreadState {
7474
/// @param hash A pointer to the hash-table instance.
7575
/// @param num_cells The number of cells that the hash-table object is going to use.
7676
/// @param nthreads The number of threads that will use the DSM-Hash object.
77-
inline void DSMHashInit(DSMHash *hash, int num_cells, int nthreads);
77+
void DSMHashInit(DSMHash *hash, int num_cells, int nthreads);
7878

7979
/// @brief This function should be called once before the thread applies any operation to the DSM-Hash combining object.
8080
///
8181
/// @param hash A pointer to the hash-table instance.
8282
/// @param th_state A pointer to thread's local state of DSM-Hash.
8383
/// @param num_cells The number of cells that the hash-table object is going to use.
8484
/// @param pid The pid of the calling thread.
85-
inline void DSMHashThreadStateInit(DSMHash *hash, DSMHashThreadState *th_state, int num_cells, int pid);
85+
void DSMHashThreadStateInit(DSMHash *hash, DSMHashThreadState *th_state, int num_cells, int pid);
8686

8787
/// @brief This function tries to insert a <key,value> into the hash-table if there is enough space in the
8888
/// corresponding cell. If the key already exists in the hash-table, DSMHashInsert updates the corresponding value.
@@ -93,7 +93,7 @@ inline void DSMHashThreadStateInit(DSMHash *hash, DSMHashThreadState *th_state,
9393
/// @param value The value of the <key,value> pair that DSMHashInsert will try to insert into the hash-table.
9494
/// @param pid The pid of the calling thread.
9595
/// @return In case of success true is returned. In case that there is not enough space in the corresponding cell.
96-
inline bool DSMHashInsert(DSMHash *hash, DSMHashThreadState *th_state, int64_t key, int64_t value, int pid);
96+
bool DSMHashInsert(DSMHash *hash, DSMHashThreadState *th_state, int64_t key, int64_t value, int pid);
9797

9898
/// @brief This function searches for a specific key in the hash-table. In case that DSMHashSearch finds the key,
9999
/// it returns true. Otherwise, it returns false.
@@ -103,7 +103,7 @@ inline bool DSMHashInsert(DSMHash *hash, DSMHashThreadState *th_state, int64_t k
103103
/// @param key The key of the <key,value> pair that DSMHashSearch will search for.
104104
/// @param pid The pid of the calling thread.
105105
/// @return DSMHashSearch returns the value of the <key,value> pair in case that the key exists in the hash-table.
106-
inline RetVal DSMHashSearch(DSMHash *hash, DSMHashThreadState *th_state, int64_t key, int pid);
106+
RetVal DSMHashSearch(DSMHash *hash, DSMHashThreadState *th_state, int64_t key, int pid);
107107

108108
/// @brief This function searches for a specific key in the hash-table. In case that DSMHashDelete finds the key,
109109
/// it deletes the corresponding <key,value>.
@@ -112,6 +112,6 @@ inline RetVal DSMHashSearch(DSMHash *hash, DSMHashThreadState *th_state, int64_t
112112
/// @param th_state A pointer to thread's local state of DSM-Hash.
113113
/// @param key The key of the <key,value> pair that DSMHashDelete will try to delete it.
114114
/// @param pid The pid of the calling thread.
115-
inline void DSMHashDelete(DSMHash *hash, DSMHashThreadState *th_state, int64_t key, int pid);
115+
void DSMHashDelete(DSMHash *hash, DSMHashThreadState *th_state, int64_t key, int pid);
116116

117117
#endif

0 commit comments

Comments
 (0)