1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Bug 565586: Handle -include and -imacros compiler flags

Change-Id: Iee67ab08ed2daa9af69fa1de583f3c6f8305960a
Signed-off-by: Martin Weber <fifteenknots505@gmail.com>
This commit is contained in:
Martin Weber 2020-07-30 20:05:38 +02:00
parent a1a3b357ec
commit 45c979c400
12 changed files with 474 additions and 9 deletions

View file

@ -389,12 +389,13 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
@Override
public void acceptSourceFileInfo(String sourceFileName, List<String> systemIncludePaths,
Map<String, String> definedSymbols, List<String> includePaths) {
Map<String, String> definedSymbols, List<String> includePaths, List<String> macroFiles,
List<String> includeFiles) {
IFile file = getFileForCMakePath(sourceFileName);
if (file != null) {
ExtendedScannerInfo info = new ExtendedScannerInfo(definedSymbols,
systemIncludePaths.stream().toArray(String[]::new), null, null,
includePaths.stream().toArray(String[]::new));
systemIncludePaths.stream().toArray(String[]::new), macroFiles.stream().toArray(String[]::new),
includeFiles.stream().toArray(String[]::new), includePaths.stream().toArray(String[]::new));
infoPerResource.put(file, info);
haveUpdates = true;
}

View file

@ -27,6 +27,8 @@ th, td {
<th>Macros</th>
<th>Include directories</th>
<th>System include<br/>directories</th>
<th>Macros file</th>
<th>Include file</th>
<th>Compiler executables</th>
</tr>
</thead>
@ -38,6 +40,8 @@ th, td {
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes (-imacros)</td>
<td>Yes (-include)</td>
<td>cc, cc.exe, gcc, gcc.exe, <a href="#fw-gcc-cross">".+-gcc"</a>, <a href="#fw-gcc-cross">".+-gcc.exe"</a></td>
</tr>
<tr>
@ -47,6 +51,8 @@ th, td {
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>Yes (-imacros)</td>
<td>Yes (-include)</td>
<td>c++, c++.exe, g++, g++.exe, <a href="#fw-g++-cross">".+-g\+\+"</a>, <a href="#fw-g++-cross">".+-g\+\+.exe"</a>
, <a href="#fw-g++-cross">".+-c\+\+"</a>, <a href="#fw-g++-cross">".+-c\+\+.exe"</a></td>
</tr>
@ -57,6 +63,8 @@ th, td {
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>N/A</td>
<td>Yes (-include)</td>
<td>clang, clang.exe</td>
</tr>
<tr>
@ -66,6 +74,8 @@ th, td {
<td>Yes</td>
<td>Yes</td>
<td>Yes</td>
<td>N/A</td>
<td>Yes (-include)</td>
<td>clang++, clang++.exe</td>
</tr>
<tr>
@ -75,6 +85,8 @@ th, td {
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>cc, cc.exe</td>
</tr>
<tr>
@ -84,6 +96,8 @@ th, td {
<td>Yes</td>
<td>Yes</td>
<td>No</td>
<td>No</td>
<td>No</td>
<td>c++, c++.exe</td>
</tr>
</tbody>

View file

@ -0,0 +1,143 @@
/*******************************************************************************
* Copyright (c) 2020 Martin Weber.
*
* Content is provided to you under the terms and conditions of the Eclipse Public License Version 2.0 "EPL".
* A copy of the EPL is available at http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.cdt.cmake.is.core.internal;
import static org.junit.Assert.assertEquals;
import org.eclipse.cdt.cmake.is.core.participant.Arglets.IncludeFile_GCC;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.junit.Before;
import org.junit.Test;
/**
* @author Martin Weber
*/
public class IncludeFile_GCCTest {
private IncludeFile_GCC testee;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
testee = new IncludeFile_GCC();
}
/**
* Test method for {@link IncludeFile_GCC#processArgument(IParseContext, IPath, java.lang.String)} .
*/
@Test
public final void testProcessArgument() {
final String more = " -o CMakeFiles/execut1.dir/util1.c.o -c /testprojects/C-subsrc/src/src-sub/main1.c";
ParseContext result;
String parsed;
String name = "/an/Include/file.inc";
IPath cwd = new Path("");
// -include/an/Include/file.inc
result = new ParseContext();
assertEquals(8 + name.length(), testee.processArgument(result, cwd, "-include" + name + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
// -include'/an/Include/file.inc'
result = new ParseContext();
assertEquals(8 + name.length() + 2, testee.processArgument(result, cwd, "-include" + "'" + name + "'" + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
// -include"/an/Include/file.inc"
result = new ParseContext();
assertEquals(8 + name.length() + 2,
testee.processArgument(result, cwd, "-include" + "\"" + name + "\"" + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
// -include /an/Include/file.inc
result = new ParseContext();
assertEquals(8 + name.length() + 3, testee.processArgument(result, cwd, "-include " + name + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
// -include '/an/Include/file.inc'
result = new ParseContext();
assertEquals(8 + name.length() + 3 + 2,
testee.processArgument(result, cwd, "-include " + "'" + name + "'" + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
// -include "/an/Include/file.inc"
result = new ParseContext();
assertEquals(8 + name.length() + 3 + 2,
testee.processArgument(result, cwd, "-include " + "\"" + name + "\"" + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
name = (new Path("A:an\\Include/file.inc")).toOSString();
// -includeA:an\Include/file.inc
result = new ParseContext();
assertEquals(8 + name.length(), testee.processArgument(result, cwd, "-include" + name + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
}
/**
* Test method for {@link IncludeFile_GCC#processArgument(IParseContext, IPath, java.lang.String)}
*/
@Test
public final void testProcessArgument_WS() {
final String more = " -o CMakeFiles/execut1.dir/util1.c.o -c /testprojects/C-subsrc/src/src-sub/main1.c";
ParseContext result = new ParseContext();
String parsed;
String name = "/ye olde/In clu de/fi le.inc";
IPath cwd = new Path("");
// -include'/ye olde/In clu de/fi le.inc'
result = new ParseContext();
assertEquals(8 + name.length() + 2, testee.processArgument(result, cwd, "-include" + "'" + name + "'" + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
// -include"/ye olde/In clu de/fi le.inc"
result = new ParseContext();
assertEquals(8 + name.length() + 2,
testee.processArgument(result, cwd, "-include" + "\"" + name + "\"" + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
// -include '/ye olde/In clu de/fi le.inc'
result = new ParseContext();
assertEquals(8 + name.length() + 3 + 2,
testee.processArgument(result, cwd, "-include " + "'" + name + "'" + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
// -include "/ye olde/In clu de/fi le.inc"
result = new ParseContext();
assertEquals(8 + name.length() + 3 + 2,
testee.processArgument(result, cwd, "-include " + "\"" + name + "\"" + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
name = (new Path("A:an\\In CLU de/fi le.inc")).toOSString();
// -include'A:an\In CLU de/fi le.inc'
result = new ParseContext();
assertEquals(8 + name.length() + 2,
testee.processArgument(result, cwd, "-include" + "\"" + name + "\"" + more));
assertEquals("#entries", 1, result.getIncludeFiles().size());
parsed = result.getIncludeFiles().get(0);
assertEquals("name", name, parsed);
}
}

View file

@ -0,0 +1,143 @@
/*******************************************************************************
* Copyright (c) 2020 Martin Weber.
*
* Content is provided to you under the terms and conditions of the Eclipse Public License Version 2.0 "EPL".
* A copy of the EPL is available at http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.cdt.cmake.is.core.internal;
import static org.junit.Assert.assertEquals;
import org.eclipse.cdt.cmake.is.core.participant.Arglets.MacrosFile_GCC;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.junit.Before;
import org.junit.Test;
/**
* @author Martin Weber
*/
public class MacrosFile_GCCTest {
private MacrosFile_GCC testee;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
testee = new MacrosFile_GCC();
}
/**
* Test method for {@link MacrosFile_GCC#processArgument(IParseContext, IPath, java.lang.String)} .
*/
@Test
public final void testProcessArgument() {
final String more = " -o CMakeFiles/execut1.dir/util1.c.o -c /testprojects/C-subsrc/src/src-sub/main1.c";
ParseContext result;
String parsed;
String name = "/an/Macros/file.inc";
IPath cwd = new Path("");
// -imacros/an/Macros/file.inc
result = new ParseContext();
assertEquals(8 + name.length(), testee.processArgument(result, cwd, "-imacros" + name + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
// -imacros'/an/Macros/file.inc'
result = new ParseContext();
assertEquals(8 + name.length() + 2, testee.processArgument(result, cwd, "-imacros" + "'" + name + "'" + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
// -imacros"/an/Macros/file.inc"
result = new ParseContext();
assertEquals(8 + name.length() + 2,
testee.processArgument(result, cwd, "-imacros" + "\"" + name + "\"" + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
// -imacros /an/Macros/file.inc
result = new ParseContext();
assertEquals(8 + name.length() + 3, testee.processArgument(result, cwd, "-imacros " + name + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
// -imacros '/an/Macros/file.inc'
result = new ParseContext();
assertEquals(8 + name.length() + 3 + 2,
testee.processArgument(result, cwd, "-imacros " + "'" + name + "'" + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
// -imacros "/an/Macros/file.inc"
result = new ParseContext();
assertEquals(8 + name.length() + 3 + 2,
testee.processArgument(result, cwd, "-imacros " + "\"" + name + "\"" + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
name = (new Path("A:an\\Macros/file.inc")).toOSString();
// -imacrosA:an\Macros/file.inc
result = new ParseContext();
assertEquals(8 + name.length(), testee.processArgument(result, cwd, "-imacros" + name + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
}
/**
* Test method for {@link MacrosFile_GCC#processArgument(IParseContext, IPath, java.lang.String)}
*/
@Test
public final void testProcessArgument_WS() {
final String more = " -o CMakeFiles/execut1.dir/util1.c.o -c /testprojects/C-subsrc/src/src-sub/main1.c";
ParseContext result = new ParseContext();
String parsed;
String name = "/ye olde/Ma cr os/fi le.inc";
IPath cwd = new Path("");
// -imacros'/ye olde/Ma cr os/fi le.inc'
result = new ParseContext();
assertEquals(8 + name.length() + 2, testee.processArgument(result, cwd, "-imacros" + "'" + name + "'" + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
// -imacros"/ye olde/Ma cr os/fi le.inc"
result = new ParseContext();
assertEquals(8 + name.length() + 2,
testee.processArgument(result, cwd, "-imacros" + "\"" + name + "\"" + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
// -imacros '/ye olde/Ma cr os/fi le.inc'
result = new ParseContext();
assertEquals(8 + name.length() + 3 + 2,
testee.processArgument(result, cwd, "-imacros " + "'" + name + "'" + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
// -imacros "/ye olde/Ma cr os/fi le.inc"
result = new ParseContext();
assertEquals(8 + name.length() + 3 + 2,
testee.processArgument(result, cwd, "-imacros " + "\"" + name + "\"" + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
name = (new Path("A:an\\Ma cr os/fi le.inc")).toOSString();
// -imacros'A:an\Ma cr os/fi le.inc'
result = new ParseContext();
assertEquals(8 + name.length() + 2,
testee.processArgument(result, cwd, "-imacros" + "\"" + name + "\"" + more));
assertEquals("#entries", 1, result.getMacroFiles().size());
parsed = result.getMacroFiles().get(0);
assertEquals("name", name, parsed);
}
}

View file

@ -337,10 +337,12 @@ public class CompileCommandsJsonParser {
.concat(fileResult.getSystemIncludePaths().stream(),
builtinDetectorsResult.getSystemIncludePaths().stream())
.map(stringPooler).collect(Collectors.toList());
List<String> macroFiles = fileResult.getMacroFiles();
List<String> includeFiles = fileResult.getIncludeFiles();
// feed the paths and defines with the file name to the indexer..
parseRequest.getIndexerInfoConsumer().acceptSourceFileInfo(sourceFileName, systemIncludePaths, effectiveDefines,
includePaths);
includePaths, macroFiles, includeFiles);
}
private static void createMarker(IResource rc, String message) throws CoreException {

View file

@ -41,9 +41,16 @@ public interface IIndexerInfoConsumer {
* the preprocessor macros used to compile the given source file
* @param includePaths
* the local include paths ({@code #include "..."}) used to compile the given source file
* @param macroFiles
* the names of files that will be pre-processed by the compiler before parsing the source-file in
* order to populate the preprocessor macro-dictionary
* @param includeFiles
* the names of files that will be pre-processed by the compiler as if
* an {@code #include "file"} directive appeared as the first line of the source file
*/
void acceptSourceFileInfo(String sourceFileName, List<String> systemIncludePaths,
Map<String, String> definedSymbols, List<String> includePaths);
Map<String, String> definedSymbols, List<String> includePaths, List<String> macroFiles,
List<String> includeFiles);
/**
* Notifies this consumer that no further calls to {link {@link #acceptSourceFileInfo(String, List, Map, List)} will

View file

@ -25,8 +25,8 @@ import org.eclipse.cdt.cmake.is.core.participant.DefaultToolDetectionParticipant
import org.eclipse.cdt.cmake.is.core.participant.IArglet;
import org.eclipse.cdt.cmake.is.core.participant.IToolCommandlineParser;
import org.eclipse.cdt.cmake.is.core.participant.IToolDetectionParticipant;
import org.eclipse.cdt.cmake.is.core.participant.ResponseFileArglets;
import org.eclipse.cdt.cmake.is.core.participant.IToolDetectionParticipant.MatchResult;
import org.eclipse.cdt.cmake.is.core.participant.ResponseFileArglets;
import org.eclipse.cdt.cmake.is.core.participant.builtins.IBuiltinsDetectionBehavior;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@ -63,7 +63,8 @@ public final class ParserDetection {
final IArglet[] gcc_args = { new Arglets.IncludePath_C_POSIX(), new Arglets.MacroDefine_C_POSIX(),
new Arglets.MacroUndefine_C_POSIX(),
// not defined by POSIX, but does not harm..
new Arglets.SystemIncludePath_C(), new Arglets.LangStd_GCC(), new Arglets.Sysroot_GCC() };
new Arglets.SystemIncludePath_C(), new Arglets.LangStd_GCC(), new Arglets.Sysroot_GCC(),
new Arglets.IncludeFile_GCC(), new Arglets.MacrosFile_GCC() };
IBuiltinsDetectionBehavior btbGccMaybee = new MaybeGccBuiltinDetectionBehavior();
IBuiltinsDetectionBehavior btbGcc = new GccBuiltinDetectionBehavior();

View file

@ -40,6 +40,8 @@ public class RawIndexerInfo implements IRawIndexerInfo, IRawIndexerInfoCollector
private final List<String> undefines = new ArrayList<>();
private final List<String> includePaths = new ArrayList<>();
private final List<String> systemIncludePaths = new ArrayList<>();
private final List<String> macroFiles = new ArrayList<>(0);
private final List<String> includeFiles = new ArrayList<>(0);
@Override
public void addDefine(String name, String value) {
@ -87,6 +89,22 @@ public class RawIndexerInfo implements IRawIndexerInfo, IRawIndexerInfoCollector
systemIncludePaths.add(path);
}
@Override
public void addMacroFile(String path) {
Objects.requireNonNull(path);
if (DEBUG)
System.out.printf(" Added macro file: %s%n", path); //$NON-NLS-1$
macroFiles.add(path);
}
@Override
public void addIncludeFile(String path) {
Objects.requireNonNull(path);
if (DEBUG)
System.out.printf(" Added include file: %s%n", path); //$NON-NLS-1$
includeFiles.add(path);
}
@Override
public Map<String, String> getDefines() {
return Collections.unmodifiableMap(defines);
@ -106,4 +124,14 @@ public class RawIndexerInfo implements IRawIndexerInfo, IRawIndexerInfoCollector
public List<String> getSystemIncludePaths() {
return Collections.unmodifiableList(systemIncludePaths);
}
@Override
public List<String> getMacroFiles() {
return Collections.unmodifiableList(macroFiles);
}
@Override
public List<String> getIncludeFiles() {
return Collections.unmodifiableList(includeFiles);
}
}

View file

@ -210,6 +210,56 @@ public final class Arglets {
}
}
/**
* A tool argument parser capable to parse a C-compiler include file argument.
*/
public static abstract class IncludeFileGeneric {
/**
* @param cwd
* the current working directory of the compiler at its invocation
*/
protected final int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine,
NameOptionMatcher[] optionMatchers) {
for (NameOptionMatcher oMatcher : optionMatchers) {
final Matcher matcher = oMatcher.matcher;
matcher.reset(argsLine);
if (matcher.lookingAt()) {
String name = matcher.group(oMatcher.nameGroup);
resultCollector.addIncludeFile(name);
final int end = matcher.end();
return end;
}
}
return 0;// no input consumed
}
}
/**
* A tool argument parser capable to parse a C-compiler macros file argument.
*/
public static abstract class MacrosFileGeneric {
/**
* @param cwd
* the current working directory of the compiler at its invocation
*/
protected final int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine,
NameOptionMatcher[] optionMatchers) {
for (NameOptionMatcher oMatcher : optionMatchers) {
final Matcher matcher = oMatcher.matcher;
matcher.reset(argsLine);
if (matcher.lookingAt()) {
String name = matcher.group(oMatcher.nameGroup);
resultCollector.addMacroFile(name);
final int end = matcher.end();
return end;
}
}
return 0;// no input consumed
}
}
////////////////////////////////////////////////////////////////////
// POSIX compatible option parsers
////////////////////////////////////////////////////////////////////
@ -367,6 +417,44 @@ public final class Arglets {
}
}
////////////////////////////////////////////////////////////////////
/**
* A tool argument parser capable to parse a GCC include file argument {@code -include <file>}.
*/
public static class IncludeFile_GCC extends IncludeFileGeneric implements IArglet {
@SuppressWarnings("nls")
private static final NameOptionMatcher[] optionMatchers = {
/* "-include=" quoted directory */
new NameOptionMatcher("-include" + REGEX_INCLUDEPATH_QUOTED_DIR, 2),
/* "-include=" unquoted directory */
new NameOptionMatcher("-include" + REGEX_INCLUDEPATH_UNQUOTED_DIR, 1), };
@Override
public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) {
return processArgument(resultCollector, cwd, argsLine, optionMatchers);
}
}
/**
* A tool argument parser capable to parse a GCC macros file argument {@code -imacros <file>}.
*/
public static class MacrosFile_GCC extends MacrosFileGeneric implements IArglet {
@SuppressWarnings("nls")
private static final NameOptionMatcher[] optionMatchers = {
/* "-include=" quoted directory */
new NameOptionMatcher("-imacros" + REGEX_INCLUDEPATH_QUOTED_DIR, 2),
/* "-include=" unquoted directory */
new NameOptionMatcher("-imacros" + REGEX_INCLUDEPATH_UNQUOTED_DIR, 1), };
/*-
* @see de.marw.cmake.cdt.lsp.IArglet#processArgs(java.lang.String)
*/
@Override
public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) {
return processArgument(resultCollector, cwd, argsLine, optionMatchers);
}
}
////////////////////////////////////////////////////////////////////
/**
* A tool argument parser capable to parse a GCC option to specify paths

View file

@ -41,4 +41,16 @@ public interface IRawIndexerInfo {
* Gets the preprocessor system include paths collected from the command-line.
*/
List<String> getSystemIncludePaths();
/**
* Gets the names of files will be pre-processed by the compiler before parsing the source-file in
* order to populate the preprocessor macro-dictionary.
*/
List<String> getMacroFiles();
/**
* Gets the names of files that will be pre-processed by the compiler as if
* an {@code #include "file"} directive appeared as the first line of the source file.
*/
List<String> getIncludeFiles();
}

View file

@ -44,11 +44,26 @@ public interface IRawIndexerInfoCollector {
*/
void addIncludePath(String path);
/**
* Adds the name of a file that will be pre-processed by the compiler before parsing the source-file in
* order to populate the preprocessor macro-dictionary.
*
* @param path the name of the file
*/
void addSystemIncludePath(String path);
/**
* Adds the name of a file that will be pre-processed by the compiler as if
* an {@code #include "file"} directive appeared as the first line of the source file.
*
* @param path the name of the file
*/
void addMacroFile(String path);
/**
* Adds a preprocessor system include path.
*
* @param path the name of the include directory
*/
void addSystemIncludePath(String path);
void addIncludeFile(String path);
}

View file

@ -93,5 +93,16 @@ public class NvccOutputProcessorTest {
Objects.requireNonNull(path);
systemIncludePaths.add(path);
}
@Override
public void addMacroFile(String path) {
// nvcc does not have a corresponding option
}
@Override
public void addIncludeFile(String path) {
// nvcc does not have a corresponding option
}
}
}