Accept extensions other than .cpp in nvq++
#2514
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem description
I took a look at
nvq++
after reading #2512 and found the culprit:file=$(basename -s .cc -s .cpp $i)
nvq++
seems to be written to already allow .cc files. However,basename
only honors the latest -s option when multiple ones are provided:Assume to be compiling a file named
ghz.cc
; during the compilation steps the following command would be run bynvq++
(simplified for clarity):This command will create two files:
ghz.cc.qke
andghz.ll
. Note that the LLVM IR file does not have the ".cc" part.The compilation will fail due to the unexpected filename and that specific .ll file will be kept as a leftover.
Proposed solution
basename
can still be used to get a "stem.suffix" string. The suffix can then be removed using Bash Parameter Substitution.I also added the support for
.cxx
and.c++
as these are common enough C++ source file extensions.