Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept extensions other than .cpp in nvq++ #2514

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tools/nvqpp/nvq++.in
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ while [ $# -ne 0 ]; do
*.o | *.so | *.bundle)
OBJS="${OBJS} $1"
;;
*.cpp | *.cc)
*.cpp | *.cc | *.cxx | *.c++)
SRCS="${SRCS} $1"
;;
*.a | *.dylib)
Expand Down Expand Up @@ -746,7 +746,8 @@ if ${SHOW_VERSION} && [ -z "$SRCS" ] && [ -z "$OBJS" ]; then
fi

for i in ${SRCS}; do
file=$(basename -s .cc -s .cpp $i)
file_with_suffix=$(basename $i)
file=${file_with_suffix%%.*}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is closer, but will fail if the source file has more than one . in the name. (It removes everything after the first ..)

Maybe let's try writing a simple function to do this instead. Something like this ought to catch the 4 cases precisely.

function remove_suffix {
  case $1 in
  *.cpp) rv=`basename -s .cpp $i` ;;
  ...
  esac
  $rv
}


# If LIBRARY_MODE explicitly requested, then
# simply compile with the classical compiler.
Expand Down
Loading