aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt29
-rw-r--r--Makefile8
-rw-r--r--src/nvim/indent.c4
-rw-r--r--src/nvim/option.c13
-rw-r--r--src/nvim/os_unix.c8
-rw-r--r--src/nvim/path.c2
-rw-r--r--src/nvim/path.h1
-rw-r--r--src/nvim/syntax.c29
-rw-r--r--src/nvim/version.c2
-rw-r--r--src/nvim/window.c1
-rw-r--r--third-party/CMakeLists.txt15
11 files changed, 64 insertions, 48 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20d653a082..42eb50ac43 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,12 +5,8 @@ project(NEOVIM)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Prefer our bundled versions of dependencies.
-set(DEPS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.deps")
-set(DEPS_BUILD_DIR "${DEPS_DIR}/build")
-set(DEPS_INSTALL_DIR "${DEPS_DIR}/usr")
-set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin")
-
-list(APPEND CMAKE_PREFIX_PATH ${DEPS_INSTALL_DIR})
+set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
+list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX})
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# CMake tries to treat /sw and /opt/local as extension of the system path, but
@@ -74,6 +70,17 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
# does not work with Neovim due to some uses of dynamically-sized structures.
# See https://github.com/neovim/neovim/issues/223 for details.
include(CheckCSourceCompiles)
+
+# Include the build type's default flags in the check for _FORTIFY_SOURCE,
+# otherwise we may incorrectly identify the level as acceptable and find out
+# later that it was not when optimizations were enabled. CFLAGS is applied
+# even though you don't see it in CMAKE_REQUIRED_FLAGS.
+set(INIT_FLAGS_NAME CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE})
+string(TOUPPER ${INIT_FLAGS_NAME} INIT_FLAGS_NAME)
+if(${INIT_FLAGS_NAME})
+ set(CMAKE_REQUIRED_FLAGS "${${INIT_FLAGS_NAME}}")
+endif()
+
check_c_source_compiles("
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 1
#error \"_FORTIFY_SOURCE > 1\"
@@ -86,10 +93,16 @@ main(void)
" _FORTIFY_SOURCE_ACCEPTABLE)
if(NOT _FORTIFY_SOURCE_ACCEPTABLE)
+ # Extract possible prefix to _FORTIFY_SOURCE (e.g. -Wp,-D_FORTIFY_SOURCE).
+ STRING(REGEX MATCH "[^\ ]+-D_FORTIFY_SOURCE" _FORTIFY_SOURCE_PREFIX "${CMAKE_C_FLAGS}")
+ STRING(REPLACE "-D_FORTIFY_SOURCE" "" _FORTIFY_SOURCE_PREFIX "${_FORTIFY_SOURCE_PREFIX}" )
+ if (NOT _FORTIFY_SOURCE_PREFIX STREQUAL "")
+ message(STATUS "Detected _FORTIFY_SOURCE Prefix=${_FORTIFY_SOURCE_PREFIX}")
+ endif()
# -U in add_definitions doesn't end up in the correct spot, so we add it to
# the flags variable instead.
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FORTIFY_SOURCE_PREFIX}-U_FORTIFY_SOURCE ${_FORTIFY_SOURCE_PREFIX}-D_FORTIFY_SOURCE=1")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_FORTIFY_SOURCE_PREFIX}-U_FORTIFY_SOURCE ${_FORTIFY_SOURCE_PREFIX}-D_FORTIFY_SOURCE=1")
endif()
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
diff --git a/Makefile b/Makefile
index c675965048..7a37e9ba4b 100644
--- a/Makefile
+++ b/Makefile
@@ -64,15 +64,15 @@ build/.ran-cmake: | deps
deps: | build/.ran-third-party-cmake
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
- +$(BUILD_CMD) -C .deps/build/third-party
+ +$(BUILD_CMD) -C .deps
endif
build/.ran-third-party-cmake:
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
- mkdir -p .deps/build/third-party
- cd .deps/build/third-party && \
+ mkdir -p .deps
+ cd .deps && \
cmake -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) \
- $(DEPS_CMAKE_FLAGS) ../../../third-party
+ $(DEPS_CMAKE_FLAGS) ../third-party
endif
mkdir -p build
touch $@
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index 7090e007bf..075acc6c13 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -58,8 +58,8 @@ int get_indent_str(char_u *ptr, int ts, int list)
if (!list || lcs_tab1) { // count a tab for what it is worth
count += ts - (count % ts);
} else {
- // in list mode, when tab is not set, count screen char width for Tab:
- // ^I
+ // In list mode, when tab is not set, count screen char width
+ // for Tab, displays: ^I
count += ptr2cells(ptr);
}
} else if (*ptr == ' ') {
diff --git a/src/nvim/option.c b/src/nvim/option.c
index c1ab3f2ee5..2b3c87511e 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -6196,15 +6196,17 @@ int makeset(FILE *fd, int opt_flags, int local_only)
int pri;
/*
- * The options that don't have a default (terminal name, columns, lines)
- * are never written. Terminal options are also not written.
+ * Some options are never written:
+ * - Options that don't have a default (terminal name, columns, lines).
+ * - Terminal options.
+ * - Hidden options.
+ *
* Do the loop over "options[]" twice: once for options with the
* P_PRI_MKRC flag and once without.
*/
for (pri = 1; pri >= 0; --pri) {
for (p = &options[0]; !istermoption(p); p++)
if (!(p->flags & P_NO_MKRC)
- && !istermoption(p)
&& ((pri == 1) == ((p->flags & P_PRI_MKRC) != 0))) {
/* skip global option when only doing locals */
if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL))
@@ -6215,8 +6217,11 @@ int makeset(FILE *fd, int opt_flags, int local_only)
if ((opt_flags & OPT_GLOBAL) && (p->flags & P_NOGLOB))
continue;
- /* Global values are only written when not at the default value. */
varp = get_varp_scope(p, opt_flags);
+ /* Hidden options are never written. */
+ if (!varp)
+ continue;
+ /* Global values are only written when not at the default value. */
if ((opt_flags & OPT_GLOBAL) && optval_default(p, varp))
continue;
diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c
index a9c1fec0b4..612f475933 100644
--- a/src/nvim/os_unix.c
+++ b/src/nvim/os_unix.c
@@ -1066,10 +1066,12 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|| pat[i][j + 1] == '`')
*p++ = '\\';
++j;
- } else if (!intick && vim_strchr(SHELL_SPECIAL,
- pat[i][j]) != NULL)
+ } else if (!intick
+ && ((flags & EW_KEEPDOLLAR) == 0 || pat[i][j] != '$')
+ && vim_strchr(SHELL_SPECIAL, pat[i][j]) != NULL)
/* Put a backslash before a special character, but not
- * when inside ``. */
+ * when inside ``. And not for $var when EW_KEEPDOLLAR is
+ * set. */
*p++ = '\\';
/* Copy one character. */
diff --git a/src/nvim/path.c b/src/nvim/path.c
index e8d31f3f73..950cc5a83a 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1080,7 +1080,7 @@ gen_expand_wildcards (
free(p);
ga_clear_strings(&ga);
i = mch_expand_wildcards(num_pat, pat, num_file, file,
- flags);
+ flags | EW_KEEPDOLLAR);
recursive = FALSE;
return i;
}
diff --git a/src/nvim/path.h b/src/nvim/path.h
index 9a994f3477..628ea335ed 100644
--- a/src/nvim/path.h
+++ b/src/nvim/path.h
@@ -17,6 +17,7 @@
#define EW_ICASE 0x100 /* ignore case */
#define EW_NOERROR 0x200 /* no error for bad regexp */
#define EW_NOTWILD 0x400 /* add match with literal name if exists */
+#define EW_KEEPDOLLAR 0x800 /* do not escape $, $var is expanded */
/* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
* is used when executing commands and EW_SILENT for interactive expanding. */
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index b7a485598b..3deda0a8c9 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5157,22 +5157,21 @@ get_id_list (
regmatch.rm_ic = TRUE;
id = 0;
for (int i = highlight_ga.ga_len; --i >= 0; ) {
- if (!vim_regexec(&regmatch, HL_TABLE()[i].sg_name, (colnr_T)0)) {
- continue;
- }
- if (round == 2) {
- /* Got more items than expected; can happen
- * when adding items that match:
- * "contains=a.*b,axb".
- * Go back to first round */
- if (count >= total_count) {
- free(retval);
- round = 1;
- } else
- retval[count] = i + 1;
+ if (vim_regexec(&regmatch, HL_TABLE()[i].sg_name, (colnr_T)0)) {
+ if (round == 2) {
+ /* Got more items than expected; can happen
+ * when adding items that match:
+ * "contains=a.*b,axb".
+ * Go back to first round */
+ if (count >= total_count) {
+ free(retval);
+ round = 1;
+ } else
+ retval[count] = i + 1;
+ }
+ ++count;
+ id = -1; /* remember that we found one */
}
- ++count;
- id = -1; /* remember that we found one */
}
vim_regfree(regmatch.regprog);
}
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 3460b7c6c3..de4f6ffd87 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -306,7 +306,7 @@ static int included_patches[] = {
//426 NA
425,
//424 NA
- //423,
+ 423,
//422,
421,
//420 NA
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 0ed43b0184..029fcaac8b 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1977,6 +1977,7 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp)
tabpage_T *ptp = NULL;
int free_tp = FALSE;
+ assert(win->w_buffer); // to avoid np dereference warning in next line
if (win->w_closing || win->w_buffer->b_closing)
return; /* window is already being closed */
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index 9f0e3fac9e..5abfa23da4 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -2,15 +2,10 @@
cmake_minimum_required (VERSION 2.8.7)
project(NEOVIM_DEPS)
-if(NOT DEPS_DIR)
- get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} PATH)
- set(DEPS_DIR ${PARENT_DIR}/.deps)
-endif()
-
-set(DEPS_INSTALL_DIR "${DEPS_DIR}/usr")
-set(DEPS_BIN_DIR "${DEPS_DIR}/usr/bin")
-set(DEPS_LIB_DIR "${DEPS_DIR}/usr/lib")
-set(DEPS_BUILD_DIR "${DEPS_DIR}/build")
+set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr")
+set(DEPS_BIN_DIR "${CMAKE_BINARY_DIR}/usr/bin")
+set(DEPS_LIB_DIR "${CMAKE_BINARY_DIR}/usr/lib")
+set(DEPS_BUILD_DIR "${CMAKE_BINARY_DIR}/build")
set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads")
option(USE_BUNDLED "Use bundled dependencies." ON)
@@ -255,7 +250,7 @@ if(USE_BUNDLED_LUAROCKS)
add_custom_command(OUTPUT ${DEPS_BIN_DIR}/busted
COMMAND ${DEPS_BIN_DIR}/luarocks
- ARGS build busted 2.0.rc3 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
+ ARGS build busted 2.0.rc4 CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER}
DEPENDS luarocks)
add_custom_target(busted
DEPENDS ${DEPS_BIN_DIR}/busted)