From ba7704ab4ea6186f0a3090b930a4be7e3aa9857c Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 9 Jul 2018 11:00:01 -0400 Subject: [PATCH 1/2] test: Rename includes/pre/uv-errno.h to includes/pre/uv.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libuv users are only supposed to directly include uv.h. In v1.21.0, all the uv-*.h headers were renamed to uv/*.h, which caused the unit tests to fail with [123/125] Generating post/uv-errno.h FAILED: test/includes/post/uv-errno.h cd «SRCDIR»/src/neovim/build/test/includes && /usr/bin/clang -std=c99 -E -P «SRCDIR»/src/neovim/test/includes/pre/uv-errno.h -I/usr/include -I/usr/include -o «SRCDIR»/neovim/build/test/includes/post/uv-errno.h «SRCDIR»/src/neovim/test/includes/pre/uv-errno.h:1:10: error: 'uv-errno.h' file not found with include; use "quotes" instead #include ^~~~~~~~~~~~ "uv-errno.h" The intention of the file is to extend libuv's error constants with more values used by the unit tests. This can just as easily be achieved without poking into pseudo-private header files. --- test/includes/pre/{uv-errno.h => uv.h} | 2 +- test/unit/os/fs_spec.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename test/includes/pre/{uv-errno.h => uv.h} (79%) diff --git a/test/includes/pre/uv-errno.h b/test/includes/pre/uv.h similarity index 79% rename from test/includes/pre/uv-errno.h rename to test/includes/pre/uv.h index 6b80f60e5c..da7818cd07 100644 --- a/test/includes/pre/uv-errno.h +++ b/test/includes/pre/uv.h @@ -1,4 +1,4 @@ -#include +#include static const int kUV_ENOENT = UV_ENOENT; static const int kUV_EEXIST = UV_EEXIST; diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index ae6dfe6423..ddb438eb3d 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -27,7 +27,7 @@ cimport('./src/nvim/fileio.h') local fs = cimport('./src/nvim/os/os.h', './src/nvim/path.h') cppimport('sys/stat.h') cppimport('fcntl.h') -cppimport('uv-errno.h') +cppimport('uv.h') local s = '' for i = 0, 255 do From 9f8bd77d7b62b8f642fd8a8d3fd3a73b183cfdf4 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 10 Jul 2018 23:16:13 -0400 Subject: [PATCH 2/2] test/includes: Use ${gen_cdefs} when pre-processing headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that uv.h is directly being included, pre-processing of test/includes/pre/uv.h fails on Linux with In file included from «SRCDIR»/neovim/test/includes/pre/uv.h:1: In file included from /usr/include/uv.h:62: /usr/include/uv/unix.h:72:11: fatal error: 'uv/pthread-barrier.h' file not found # include "uv/pthread-barrier.h" ^~~~~~~~~~~~~~~~~~~~~~ 1 error generated. This happens because we're missing -D_GNU_SOURCE (part of ${gen_cdefs}), which makes the pthread_barrier_* functionality visible. --- test/includes/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/includes/CMakeLists.txt b/test/includes/CMakeLists.txt index 2846df0e37..4d7e962fbd 100644 --- a/test/includes/CMakeLists.txt +++ b/test/includes/CMakeLists.txt @@ -7,6 +7,13 @@ foreach(gen_include ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}) list(APPEND gen_cflags ${CMAKE_INCLUDE_FLAG_C}${gen_include}) endforeach() +get_directory_property(gen_cdefs COMPILE_DEFINITIONS) +foreach(gen_cdef ${gen_cdefs}) + if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS") + list(APPEND gen_cflags "-D${gen_cdef}") + endif() +endforeach() + foreach(hfile ${PRE_HEADERS}) string(REGEX REPLACE ^pre/ post/ post_hfile ${hfile}) get_filename_component(hdir ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile} PATH)