Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,14 @@ else()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()

if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(USING_CLANG ON)
else()
set(USING_CLANG OFF)
endif()

if(C_LINUX)
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCXX OR USING_CLANG)
# Set _GNU_SOURCE for O_LARGEFILE, O_CLOEXEC, O_DIRECTORY, O_NOFOLLOW, etc flags on older systems
# (pre POSIX.1-2008: glibc 2.11 and earlier). #4042
set(_GNU_SOURCE 1)
Expand Down
6 changes: 3 additions & 3 deletions clamonacc/c-thread-pool/thpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
********************************/

#define _POSIX_C_SOURCE 200809L
#define _GNU_SOURCE
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
Expand Down Expand Up @@ -471,14 +471,14 @@ static struct job* jobqueue_pull(jobqueue* jobqueue_p){
break;

case 1: /* if one job in queue */
logg(LOGG_DEBUG_NV, "jobqueue_pull: Thread %d pulled last job from queue.\n", syscall(SYS_gettid));
logg(LOGG_DEBUG_NV, "jobqueue_pull: Thread %ld pulled last job from queue.\n", syscall(SYS_gettid));
jobqueue_p->front = NULL;
jobqueue_p->rear = NULL;
jobqueue_p->len = 0;
break;

default: /* if >1 jobs in queue */
logg(LOGG_DEBUG_NV, "jobqueue_pull: Thread %d pulled a job from queue.\n", syscall(SYS_gettid));
logg(LOGG_DEBUG_NV, "jobqueue_pull: Thread %ld pulled a job from queue.\n", syscall(SYS_gettid));
jobqueue_p->front = job_p->prev;
jobqueue_p->len--;
/* more than one job in queue -> post it */
Expand Down
4 changes: 2 additions & 2 deletions clamonacc/clamonacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
pthread_t ddd_pid = 0;
pthread_t scan_queue_pid = 0;

static void onas_handle_signals();
static void onas_handle_signals(void);
static int startup_checks(struct onas_context *ctx);
static struct onas_context *g_ctx = NULL;

Expand Down Expand Up @@ -247,7 +247,7 @@ int main(int argc, char **argv)
exit(ret);
}

static void onas_handle_signals()
static void onas_handle_signals(void)
{
sigset_t sigset;
struct sigaction act;
Expand Down
2 changes: 1 addition & 1 deletion clamonacc/client/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ struct onas_sock_t {
};

cl_error_t onas_set_sock_only_once(struct onas_context *ctx);
int onas_get_sockd();
int onas_get_sockd(void);
2 changes: 1 addition & 1 deletion clamonacc/inotif/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

#if defined(HAVE_SYS_FANOTIFY_H)

static struct onas_bucket *onas_bucket_init();
static struct onas_bucket *onas_bucket_init(void);
static void onas_free_bucket(struct onas_bucket *bckt);
static int onas_bucket_insert(struct onas_bucket *bckt, struct onas_element *elem);
static int onas_bucket_remove(struct onas_bucket *bckt, struct onas_element *elem);
Expand Down
4 changes: 2 additions & 2 deletions clamonacc/inotif/inotif.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

static int onas_ddd_init_ht(uint32_t ht_size);
static int onas_ddd_init_wdlt(uint64_t nwatches);
static int onas_ddd_grow_wdlt();
static int onas_ddd_grow_wdlt(void);

static int onas_ddd_watch(const char *pathname, int fan_fd, uint64_t fan_mask, int in_fd, uint64_t in_mask);
static int onas_ddd_watch_hierarchy(const char *pathname, size_t len, int fd, uint64_t mask, uint32_t type);
Expand Down Expand Up @@ -116,7 +116,7 @@ static int onas_ddd_init_wdlt(uint64_t nwatches)
/**
* @brief Initialize watch descriptor lookup table which we use alongside inotify to keep track of which open watchpoints correspond to which objects
*/
static int onas_ddd_grow_wdlt()
static int onas_ddd_grow_wdlt(void)
{

char **ptr = NULL;
Expand Down
6 changes: 3 additions & 3 deletions clamonacc/scan/onas_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static cl_error_t onas_new_event_queue_node(struct onas_event_queue_node **node)
return CL_SUCCESS;
}

static void *onas_init_event_queue()
static void *onas_init_event_queue(void)
{

if (CL_EMEM == onas_new_event_queue_node(&g_onas_event_queue_head)) {
Expand Down Expand Up @@ -120,7 +120,7 @@ static void onas_destroy_event_queue_node(struct onas_event_queue_node *node)
return;
}

static void onas_destroy_event_queue()
static void onas_destroy_event_queue(void)
{

if (NULL == g_onas_event_queue_head) {
Expand Down Expand Up @@ -189,7 +189,7 @@ void *onas_scan_queue_th(void *arg)
pthread_cleanup_pop(1);
}

static int onas_queue_is_b_empty()
static int onas_queue_is_b_empty(void)
{

if (g_onas_event_queue.head->next == g_onas_event_queue.tail) {
Expand Down
12 changes: 9 additions & 3 deletions cmake/FindLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ else()
)
if(result_code)
_LLVM_FAIL("Failed to execute llvm-config ('${LLVM_CONFIG}', result code: '${result_code})'")
else()
else()
file(TO_CMAKE_PATH "${tmplibs}" tmplibs)
string(REGEX MATCHALL "${pattern}[^ ]+" LLVM_${var} ${tmplibs})
endif()
Expand Down Expand Up @@ -163,9 +163,15 @@ else()
set(LLVM_NATIVE_ARCH ${CMAKE_MATCH_1})
message(STATUS "LLVM_NATIVE_ARCH: ${LLVM_NATIVE_ARCH}")

if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(USING_CLANG ON)
else()
set(USING_CLANG OFF)
endif()

# On CMake builds of LLVM, the output of llvm-config --cxxflags does not
# include -fno-rtti, leading to linker errors. Be sure to add it.
if(NOT MSVC AND (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")))
if(NOT MSVC AND (CMAKE_COMPILER_IS_GNUCXX OR USING_CLANG))
if(NOT ${LLVM_CXXFLAGS} MATCHES "-fno-rtti")
set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fno-rtti")
endif()
Expand All @@ -181,7 +187,7 @@ else()
endif()

# Remove gcc-specific flags for clang.
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
if(USING_CLANG)
string(REPLACE "-Wno-maybe-uninitialized " "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS})
endif()

Expand Down
2 changes: 1 addition & 1 deletion common/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int daemonize(void);
/*closes stdin, stdout, stderr. This is called by daemonize, but not
* daemonize_all_return. Users of daemonize_all_return should call this
* when initialization is complete.*/
int close_std_descriptors();
int close_std_descriptors(void);

/*Returns the return value of fork. All processes return */
int daemonize_all_return(void);
Expand Down
2 changes: 1 addition & 1 deletion libclamav/bytecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void cli_bytecode_context_destroy(struct cli_bc_ctx *ctx);
#ifdef __cplusplus
extern "C" {
#endif
extern LIBCLAMAV_EXPORT bool have_clamjit();
extern LIBCLAMAV_EXPORT bool have_clamjit(void);
#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion libclamav/bytecode_detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define CHECK_ARCH(a) \
if (!strcmp(TARGET_ARCH_TYPE, #a)) env->arch = arch_##a

extern bool have_clamjit();
extern bool have_clamjit(void);

static void cli_print_environment(struct cli_environment *env)
{
Expand Down
6 changes: 3 additions & 3 deletions libclamav/matcher-pcre.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ void cli_pcre_freetable(struct cli_matcher *root);
/*
* The following are defined to simple stub functions in matcher-pcre.c if HAVE_PCRE is not defined.
*/
cl_error_t cli_pcre_init();
cl_error_t cli_pcre_init(void);
cl_error_t cli_pcre_build(struct cli_matcher *root, long long unsigned match_limit, long long unsigned recmatch_limit, const struct cli_dconf *dconf);
cl_error_t cli_pcre_scanbuf(const unsigned char *buffer, uint32_t length, const char **virname, struct cli_ac_result **res, const struct cli_matcher *root, struct cli_ac_data *mdata, const struct cli_pcre_off *data, cli_ctx *ctx);
cl_error_t cli_pcre_recaloff(struct cli_matcher *root, struct cli_pcre_off *data, struct cli_target_info *info, cli_ctx *ctx);
void cli_pcre_freeoff(struct cli_pcre_off *data);

void cli_pcre_perf_print();
void cli_pcre_perf_events_destroy();
void cli_pcre_perf_print(void);
void cli_pcre_perf_events_destroy(void);

#endif /*__MATCHER_PCRE_H*/
2 changes: 1 addition & 1 deletion libclamav/others.h
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ cl_error_t cli_realpath(const char *file_name, char **real_filename);
* This is required for unit tests to be able to link with clamav.dll and not
* directly manipulate libclamav global variables.
*/
uint8_t cli_get_debug_flag();
uint8_t cli_get_debug_flag(void);

/**
* @brief Set the libclamav debug flag to a specific value.
Expand Down
2 changes: 1 addition & 1 deletion libclamav/regex_pcre.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct cli_pcre_results {
};
#endif

cl_error_t cli_pcre_init_internal();
cl_error_t cli_pcre_init_internal(void);
cl_error_t cli_pcre_addoptions(struct cli_pcre_data *pd, const char **opt, int errout);
cl_error_t cli_pcre_compile(struct cli_pcre_data *pd, long long unsigned match_limit, long long unsigned match_limit_recursion, unsigned int options, int opt_override);

Expand Down