atilaneves/cmake-ide

gcc flag -m64 is not handled in cmake-ide--filter-ac-flags

strutt opened this issue · 2 comments

Compiling my project with gcc, but editing in emacs with auto-complete clang requires a work around. When I hit auto-complete I get:

clang failed with error 1:
/usr/bin/clang -cc1 -fsyntax-only -x c++ -std=c++14 -I/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1 -I/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/x86_64-pc-linux-gnu -I/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/backward -I/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/include-fixed -I/usr/include -DANITA_BUILD_TOOL -DAnitaAnalysisTools_EXPORTS -DFFTW_64_BIT -DSummarySelector_cxx -I/home/strutt/ANITA/Repositories/anitaBuildTool/components/eventReaderRoot/include -I/home/strutt/ANITA/Repositories/anitaBuildTool/components/libRootFftwWrapper/include -I/home/strutt/ANITA/Repositories/anitaBuildTool/components/libRootFftwWrapper/vectorclass -I/home/strutt/ANITA/Repositories/anitaBuildTool/components/anitaEventCorrelator/include -I/home/strutt/ANITA/Repositories/anitaBuildTool/components/anitaAnalysisTools/include -I/home/strutt/ANITA/Repositories/anitaBuildTool/components/anitaMagicDisplay/include -I/home/strutt/ANITA/Repositories/anitaBuildTool/components/AnitaAnalysisFramework/include -I/home/strutt/ANITA/Repositories/anitaBuildTool/components/UCorrelator/include -I/home/strutt/ANITA/Repositories/anitaBuildTool/components/aware/AwareWebLib/include -I/usr/include/root -I/home/strutt/ANITA/Repositories/anitaBuildTool/components/anitaAnalysisTools -I/home/strutt/ANITA/Repositories/Install/include -pthread -std=c++1y -m64 -O2 -DNDEBUG -pthread -std=c++1y -m64 -pthread -std=c++1y -m64 -o CMakeFiles/AnitaAnalysisTools.dir/src/CutOptimizer.cxx.o -code-completion-at -:56:11 -

Invoking the above command on the terminal I get:

error: unknown argument: '-m64'
error: unknown argument: '-m64'
error: unknown argument: '-m64'

The fix is simple, just update the flags in cmake-ide--filter-ac-flags:

(defun cmake-ide--filter-ac-flags (flags)
"Filter unwanted compiler arguments out from FLAGS."
(cmake-ide--filter
(lambda (x)
(cl-loop for flag in '("-m32" "-m64" "-Werror" "-c" "-fPIC" "-pipe" "-g" "-ggdb")
never (string-match (format "^%s$" flag) x)))
flags))

This fix seems a bit trivial to open a pull requst, but thought I'd let you know as it breaks the almost perfect automagic of cmake-ide. Thanks for developing this, one of my favourite emacs packages!

There's no such thing as too trivial for a PR ;)
Submit and I'll merge.

A recent PR just enabled this.