Merge pull request #3393 from openSUSE/werror

Build cgo files with -Wall and -Werror
This commit is contained in:
OpenShift Merge Robot
2019-06-21 12:59:00 +02:00
committed by GitHub
5 changed files with 6 additions and 7 deletions

View File

@ -413,7 +413,7 @@ int32_t allocate_given_semaphore(shm_struct_t *shm, uint32_t sem_index) {
// Returns 0 on success, negative ERRNO values on failure // Returns 0 on success, negative ERRNO values on failure
int32_t deallocate_semaphore(shm_struct_t *shm, uint32_t sem_index) { int32_t deallocate_semaphore(shm_struct_t *shm, uint32_t sem_index) {
bitmap_t test_map; bitmap_t test_map;
int bitmap_index, index_in_bitmap, ret_code, i; int bitmap_index, index_in_bitmap, ret_code;
if (shm == NULL) { if (shm == NULL) {
return -1 * EINVAL; return -1 * EINVAL;
@ -500,7 +500,7 @@ int32_t deallocate_all_semaphores(shm_struct_t *shm) {
// subsequently realize they have been removed). // subsequently realize they have been removed).
// Returns 0 on success, -1 on failure // Returns 0 on success, -1 on failure
int32_t lock_semaphore(shm_struct_t *shm, uint32_t sem_index) { int32_t lock_semaphore(shm_struct_t *shm, uint32_t sem_index) {
int bitmap_index, index_in_bitmap, ret_code; int bitmap_index, index_in_bitmap;
if (shm == NULL) { if (shm == NULL) {
return -1 * EINVAL; return -1 * EINVAL;
@ -522,7 +522,7 @@ int32_t lock_semaphore(shm_struct_t *shm, uint32_t sem_index) {
// subsequently realize they have been removed). // subsequently realize they have been removed).
// Returns 0 on success, -1 on failure // Returns 0 on success, -1 on failure
int32_t unlock_semaphore(shm_struct_t *shm, uint32_t sem_index) { int32_t unlock_semaphore(shm_struct_t *shm, uint32_t sem_index) {
int bitmap_index, index_in_bitmap, ret_code; int bitmap_index, index_in_bitmap;
if (shm == NULL) { if (shm == NULL) {
return -1 * EINVAL; return -1 * EINVAL;

View File

@ -1,6 +1,7 @@
package shm package shm
// #cgo LDFLAGS: -lrt -lpthread // #cgo LDFLAGS: -lrt -lpthread
// #cgo CFLAGS: -Wall -Werror
// #include <stdlib.h> // #include <stdlib.h>
// #include "shm_lock.h" // #include "shm_lock.h"
// const uint32_t bitmap_size_c = BITMAP_SIZE; // const uint32_t bitmap_size_c = BITMAP_SIZE;

View File

@ -32,9 +32,6 @@ typedef struct shm_struct {
lock_group_t locks[]; lock_group_t locks[];
} shm_struct_t; } shm_struct_t;
static size_t compute_shm_size(uint32_t num_bitmaps);
static int take_mutex(pthread_mutex_t *mutex);
static int release_mutex(pthread_mutex_t *mutex);
shm_struct_t *setup_lock_shm(char *path, uint32_t num_locks, int *error_code); shm_struct_t *setup_lock_shm(char *path, uint32_t num_locks, int *error_code);
shm_struct_t *open_lock_shm(char *path, uint32_t num_locks, int *error_code); shm_struct_t *open_lock_shm(char *path, uint32_t num_locks, int *error_code);
int32_t close_lock_shm(shm_struct_t *shm); int32_t close_lock_shm(shm_struct_t *shm);

View File

@ -22,7 +22,7 @@ import (
) )
/* /*
#cgo remoteclient CFLAGS: -DDISABLE_JOIN_SHORTCUT #cgo remoteclient CFLAGS: -Wall -Werror -DDISABLE_JOIN_SHORTCUT
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
extern uid_t rootless_uid(); extern uid_t rootless_uid();

View File

@ -11,6 +11,7 @@ import (
/* /*
#cgo LDFLAGS: -llgrp #cgo LDFLAGS: -llgrp
#cgo CFLAGS: -Wall -Werror
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/lgrp_user.h> #include <sys/lgrp_user.h>