Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java44
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/OpenDeclarationAction.java5
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java42
3 files changed, 66 insertions, 25 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java
index cb50a7e8b4c..b3b7b78edb6 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java
@@ -14,29 +14,31 @@ import org.eclipse.cdt.make.internal.core.makefile.MakeFileConstants;
public class GNUMakefileConstants extends MakeFileConstants {
- static final String CONDITIONAL_ELSE = "else"; //$NON-NLS-1$
- static final String CONDITIONAL_IFNEQ = "ifneq"; //$NON-NLS-1$
- static final String CONDITIONAL_IFNDEF = "ifndef"; //$NON-NLS-1$
- static final String CONDITIONAL_IFEQ = "ifeq"; //$NON-NLS-1$
- static final String CONDITIONAL_IFDEF = "ifdef"; //$NON-NLS-1$
+ public static final String CONDITIONAL_ELSE = "else"; //$NON-NLS-1$
+ public static final String CONDITIONAL_IFNEQ = "ifneq"; //$NON-NLS-1$
+ public static final String CONDITIONAL_IFNDEF = "ifndef"; //$NON-NLS-1$
+ public static final String CONDITIONAL_IFEQ = "ifeq"; //$NON-NLS-1$
+ public static final String CONDITIONAL_IFDEF = "ifdef"; //$NON-NLS-1$
- static final String TERMINAL_ENDEF = "endef"; //$NON-NLS-1$
- static final String TERMINAL_ENDIF = "endif"; //$NON-NLS-1$
+ public static final String TERMINAL_ENDEF = "endef"; //$NON-NLS-1$
+ public static final String TERMINAL_ENDIF = "endif"; //$NON-NLS-1$
- static final String DIRECTIVE_VPATH = "vpath"; //$NON-NLS-1$
- static final String DIRECTIVE_UNEXPORT = "unexport"; //$NON-NLS-1$
+ public static final String DIRECTIVE_VPATH = "vpath"; //$NON-NLS-1$
+ public static final String DIRECTIVE_UNEXPORT = "unexport"; //$NON-NLS-1$
- static final String VARIABLE_DEFINE = "define"; //$NON-NLS-1$
- static final String VARIABLE_EXPORT = "export"; //$NON-NLS-1$
- static final String VARIABLE_OVERRIDE = "override"; //$NON-NLS-1$
-
- static final String DIRECTIVE_INCLUDE = "include"; //$NON-NLS-1$
+ public static final String VARIABLE_DEFINE = "define"; //$NON-NLS-1$
+ public static final String VARIABLE_EXPORT = "export"; //$NON-NLS-1$
+ public static final String VARIABLE_OVERRIDE = "override"; //$NON-NLS-1$
+
+ public static final String FUNCTION_CALL = "call"; //$NON-NLS-1$
+
+ public static final String DIRECTIVE_INCLUDE = "include"; //$NON-NLS-1$
- static final String RULE_DELETE_ON_ERROR = ".DELETE_ON_ERROR"; //$NON-NLS-1$
- static final String RULE_PHONY = ".PHONY"; //$NON-NLS-1$
- static final String RULE_SECONDARY = ".SECONDARY"; //$NON-NLS-1$
- static final String RULE_LOW_RESOLUTION_TIME = ".LOW_RESOLUTION_TIME"; //$NON-NLS-1$
- static final String RULE_NOT_PARALLEL = ".NOTPARALLEL"; //$NON-NLS-1$
- static final String RULE_EXPORT_ALL_VARIABLES = ".EXPORT_ALL_VARIABLES"; //$NON-NLS-1$
- static final String RULE_INTERMEDIATE = ".INTERMEDIATE"; //$NON-NLS-1$
+ public static final String RULE_DELETE_ON_ERROR = ".DELETE_ON_ERROR"; //$NON-NLS-1$
+ public static final String RULE_PHONY = ".PHONY"; //$NON-NLS-1$
+ public static final String RULE_SECONDARY = ".SECONDARY"; //$NON-NLS-1$
+ public static final String RULE_LOW_RESOLUTION_TIME = ".LOW_RESOLUTION_TIME"; //$NON-NLS-1$
+ public static final String RULE_NOT_PARALLEL = ".NOTPARALLEL"; //$NON-NLS-1$
+ public static final String RULE_EXPORT_ALL_VARIABLES = ".EXPORT_ALL_VARIABLES"; //$NON-NLS-1$
+ public static final String RULE_INTERMEDIATE = ".INTERMEDIATE"; //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/OpenDeclarationAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/OpenDeclarationAction.java
index fa33d4dd5ac..9ba05f8c109 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/OpenDeclarationAction.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/OpenDeclarationAction.java
@@ -58,9 +58,8 @@ public class OpenDeclarationAction extends TextEditorAction {
String name = wordPart.getName();
if (wordPart.isMacro()) {
directives = makefile.getMacroDefinitions(name);
- if (directives.length == 0) {
- directives = makefile.getBuiltinMacroDefinitions(name);
- }
+ } else if (wordPart.isFunctionCall()) {
+ directives = makefile.getMacroDefinitions(wordPart.getName());
} else if (wordPart.isIncludeDirective()) {
String incFile = wordPart.getName();
incFile = makefile.expandString(incFile, true);
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java
index 6219520f83b..9907f9755d9 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.make.internal.ui.text;
+import org.eclipse.cdt.make.internal.core.makefile.gnu.GNUMakefileConstants;
import org.eclipse.cdt.make.internal.core.makefile.gnu.GNUMakefileUtil;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.jface.text.BadLocationException;
@@ -25,6 +26,7 @@ public class WordPartDetector {
private enum WORDPART_TYPE {
MACRO,
INCLUDE,
+ FUNCTION_CALL,
UNDETERMINED,
}
@@ -68,6 +70,36 @@ public class WordPartDetector {
MakeUIPlugin.log(e);
}
+ // Try to figure out if we are in a user defined function call $(call user-fun)
+ try {
+ for (int index = offset - 1; index > 0; index--) {
+ char c = document.getChar(index);
+ if (!Character.isJavaIdentifierPart(c) && c != '-' && c != ' ') {
+ boolean isFunction = (c == '(' || c == '{') && document.getChar(index-1) == '$';
+ if (isFunction) {
+ String builtinFun = document.get(index + 1,4);
+ if (builtinFun.equals(GNUMakefileConstants.FUNCTION_CALL)) {
+ type = WORDPART_TYPE.FUNCTION_CALL;
+ int nameOffset = index + 2 + GNUMakefileConstants.FUNCTION_CALL.length();
+ int endIndex = offset;
+ for (endIndex = offset; endIndex < document.getLength(); endIndex++) {
+ // skip through function name
+ char c2 = document.getChar(endIndex);
+ if (!(Character.isJavaIdentifierPart(c2) || c2 == '-')) {
+ break;
+ }
+ }
+ wordPart = document.get(nameOffset,endIndex-nameOffset);
+ return;
+ }
+ }
+ break;
+ }
+ }
+ } catch (BadLocationException e) {
+ MakeUIPlugin.log(e);
+ }
+
// Try to figure out if the cursor is on an include directive.
try {
int lineNumber = document.getLineOfOffset(offset);
@@ -91,7 +123,6 @@ public class WordPartDetector {
} catch (BadLocationException e) {
MakeUIPlugin.log(e);
}
-
}
/**
@@ -104,6 +135,15 @@ public class WordPartDetector {
}
/**
+ * Check if the cursor is in function call $(call user-fun).
+ *
+ * @return {@code true} if the cursor is located in function call, {@code false} otherwise.
+ */
+ public boolean isFunctionCall() {
+ return type == WORDPART_TYPE.FUNCTION_CALL;
+ }
+
+ /**
* Check if the cursor sits on an include directive line.
*
* @return {@code true} if the cursor is located on include line, {@code false} otherwise.

Back to the top