summaryrefslogtreecommitdiff
path: root/libusb
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2020-03-30 12:28:11 -0700
committerChris Dickens <christopher.a.dickens@gmail.com>2020-03-30 12:28:11 -0700
commit9a1bc8cafb904c20a869c74ad6d657686a1c4bb1 (patch)
tree1c6a0b258c047f83a45aa383337f63b4e85b6682 /libusb
parent0c6c072733a5a2177ffc24d2614ee1151a39f02f (diff)
downloadlibusb-9a1bc8cafb904c20a869c74ad6d657686a1c4bb1.tar.gz
build: Require C11 to build and clean up autoconfig/automake files
C11 compiler support has been available for many years now. It is not unreasonable to require this now, and doing so allows some cleanup to the configure script. It is no longer necessary to check for compiler support of the '-fvibility' flag because any compiler that supports C11 will support this flag as well. Fix up the way that compiler and linker flags are passed down to the various makefiles. The compiler flags should be shared by all, but the linker flags and libraries should be separated between the library and the examples/tests. The visibility flag is only relevant for the library and the thread flags are only relevant for sources using thread constructs, so provide them as needed. Rearrange configure.ac to group similar functionality and consolidate where possible. Based on these changes, update the Travis configuration file to include newer versions of test platforms to ensure proper C11 compiler support. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb')
-rw-r--r--libusb/Makefile.am6
-rw-r--r--libusb/libusbi.h6
-rw-r--r--libusb/os/threads_posix.c2
-rw-r--r--libusb/version_nano.h2
4 files changed, 9 insertions, 7 deletions
diff --git a/libusb/Makefile.am b/libusb/Makefile.am
index ad6e8ab..8b89ee6 100644
--- a/libusb/Makefile.am
+++ b/libusb/Makefile.am
@@ -1,5 +1,9 @@
AUTOMAKE_OPTIONS = subdir-objects
+AM_CFLAGS += -fvisibility=hidden $(THREAD_CFLAGS)
+AM_CXXFLAGS += -fvisibility=hidden $(THREAD_CFLAGS)
+AM_LDFLAGS = $(LT_LDFLAGS)
+
lib_LTLIBRARIES = libusb-1.0.la
POSIX_POLL_SRC = os/poll_posix.h os/poll_posix.c
@@ -35,7 +39,6 @@ OS_WINDOWS_SRC = libusb-1.0.def libusb-1.0.rc \
if OS_DARWIN
OS_SRC = $(OS_DARWIN_SRC)
-AM_CFLAGS_EXT = -no-cpp-precomp
endif
if OS_HAIKU
@@ -85,7 +88,6 @@ all-local: .libs/libusb-1.0.dll.a
endif
endif
-libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
libusb_1_0_la_SOURCES = libusbi.h version.h version_nano.h \
core.c descriptor.c hotplug.h hotplug.c io.c strerror.c sync.c \
$(POLL_SRC) $(THREADS_SRC) $(OS_SRC)
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index 1a5528d..9eeb920 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -93,9 +93,9 @@
/* Macro to decorate printf-like functions, in order to get
* compiler warnings about format string mistakes.
*/
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+#ifndef _MSC_VER
#define USBI_PRINTFLIKE(formatarg, firstvararg) \
- __attribute__((__format__ (__printf__, formatarg, firstvararg)))
+ __attribute__ ((__format__ (__printf__, formatarg, firstvararg)))
#else
#define USBI_PRINTFLIKE(formatarg, firstvararg)
#endif
@@ -254,7 +254,7 @@ void usbi_log(struct libusb_context *ctx, enum libusb_log_level level,
void usbi_log_v(struct libusb_context *ctx, enum libusb_log_level level,
const char *function, const char *format, va_list args) USBI_PRINTFLIKE(4, 0);
-#define _usbi_log(ctx, level, ...) usbi_log(ctx, level, __FUNCTION__, __VA_ARGS__)
+#define _usbi_log(ctx, level, ...) usbi_log(ctx, level, __func__, __VA_ARGS__)
#define usbi_err(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_ERROR, __VA_ARGS__)
#define usbi_warn(ctx, ...) _usbi_log(ctx, LIBUSB_LOG_LEVEL_WARNING, __VA_ARGS__)
diff --git a/libusb/os/threads_posix.c b/libusb/os/threads_posix.c
index 763cd84..71a404f 100644
--- a/libusb/os/threads_posix.c
+++ b/libusb/os/threads_posix.c
@@ -60,7 +60,7 @@ int usbi_cond_timedwait(pthread_cond_t *cond,
int usbi_get_tid(void)
{
-#ifdef HAVE_CC_THREAD_LOCAL
+#ifndef _WIN32
static _Thread_local int tid;
if (tid)
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 197f76f..5708a99 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11478
+#define LIBUSB_NANO 11479