From 7edb016257a988775ea42603899bca63dc2589fc Mon Sep 17 00:00:00 2001 From: Martin Weber Date: Sat, 15 Jan 2022 20:03:54 +0100 Subject: [PATCH] Bug 578223: JSON compilation database parser: Add more compiler options that affect built-in detection for gcc Change-Id: I2734b0317079d8a48fdbdde98f105bfe47dbdb8e Signed-off-by: Martin Weber --- .../META-INF/MANIFEST.MF | 2 +- .../doc/html/builtins-detection.xhtml | 6 ++++++ .../eclipse/cdt/jsoncdb/core/participant/Arglets.java | 9 +++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core.doc/META-INF/MANIFEST.MF b/jsoncdb/org.eclipse.cdt.jsoncdb.core.doc/META-INF/MANIFEST.MF index 854fc3dcc63..64c18157f99 100644 --- a/jsoncdb/org.eclipse.cdt.jsoncdb.core.doc/META-INF/MANIFEST.MF +++ b/jsoncdb/org.eclipse.cdt.jsoncdb.core.doc/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: %bundleName Bundle-Description: %Bundle-Description Bundle-Copyright: %Bundle-Copyright Bundle-SymbolicName: org.eclipse.cdt.jsoncdb.core.doc;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.0.100.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core.doc/doc/html/builtins-detection.xhtml b/jsoncdb/org.eclipse.cdt.jsoncdb.core.doc/doc/html/builtins-detection.xhtml index fcbc19327c4..73a24008219 100644 --- a/jsoncdb/org.eclipse.cdt.jsoncdb.core.doc/doc/html/builtins-detection.xhtml +++ b/jsoncdb/org.eclipse.cdt.jsoncdb.core.doc/doc/html/builtins-detection.xhtml @@ -84,6 +84,7 @@ td { Vendor Language Standard
options Non-Standard System
include paths options + Other options @@ -92,12 +93,17 @@ td { GNU Project -std=, -ansi: tested --sysroot=, -isysroot=, --no-sysroot-prefix: tested + -fPIC, -fpic, -fPIE, -fpie + -fstack-protector*, -march=, -march=, -mcpu=, + -mtune=, -pthread + clang LLVM Project -std=, -ansi: tested --sysroot=, -isysroot=, --no-sysroot-prefix: tested + diff --git a/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/participant/Arglets.java b/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/participant/Arglets.java index ae05b81f395..7a52ea8500a 100644 --- a/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/participant/Arglets.java +++ b/jsoncdb/org.eclipse.cdt.jsoncdb.core/src/org/eclipse/cdt/jsoncdb/core/participant/Arglets.java @@ -491,7 +491,7 @@ public final class Arglets { public static class Target_Clang extends BuiltinDetctionArgsGeneric implements IArglet { private static final Matcher[] optionMatchers = { /* "--target=" triple */ - Pattern.compile("--target=\\w+(-\\w+)*").matcher("") }; //$NON-NLS-1$ //$NON-NLS-2$ + Pattern.compile("--target=\\w+(-\\w+)*").matcher(EMPTY_STR) }; //$NON-NLS-1$ /*- * @see de.marw.cmake.cdt.lsp.IArglet#processArgs(java.lang.String) @@ -510,7 +510,12 @@ public final class Arglets { public static class LangStd_GCC extends BuiltinDetctionArgsGeneric implements IArglet { @SuppressWarnings("nls") private static final Matcher[] optionMatchers = { Pattern.compile("-std=\\S+").matcher(EMPTY_STR), - Pattern.compile("-ansi").matcher(EMPTY_STR), }; + Pattern.compile("-ansi").matcher(EMPTY_STR), + Pattern.compile("-fPIC", Pattern.CASE_INSENSITIVE).matcher(EMPTY_STR), + Pattern.compile("-fPIE", Pattern.CASE_INSENSITIVE).matcher(EMPTY_STR), + Pattern.compile("-fstack-protector\\S+").matcher(EMPTY_STR), + Pattern.compile("-march=\\\\S+").matcher(EMPTY_STR), Pattern.compile("-mcpu=\\\\S+").matcher(EMPTY_STR), + Pattern.compile("-mtune=\\\\S+").matcher(EMPTY_STR), Pattern.compile("-pthread").matcher(EMPTY_STR), }; /*- * @see org.eclipse.cdt.jsoncdb.IArglet#processArgs(java.lang.String)