jbenden / vscode-c-cpp-flylint

A VS Code extension for advanced, modern, static analysis of C/C++ that supports a number of back-end analyzer programs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error when c-cpp-flylint.language is set to C

chenyulue opened this issue · comments

I have set c-cpp-flylint.language to C language, there is alway an error reading:

vscode-c-cpp-flylint: 'Line could not be parsed: error: invalid argument '--std=c++11' not allowed with 'C'' while validating: c:\Users\xj\Exercism\c\sieve\sieve.c. Please analyze the 'C/C++ FlyLint' Output console. Stacktrace: Error: Line could not be parsed: error: invalid argument '--std=c++11' not allowed with 'C'
    at c:\Users\xj\.vscode\extensions\jbenden.c-cpp-flylint-1.10.2\server\out\server.js:2:13413
    at Array.forEach (<anonymous>)
    at a.parseLines (c:\Users\xj\.vscode\extensions\jbenden.c-cpp-flylint-1.10.2\server\out\server.js:2:13151)
    at a.lint (c:\Users\xj\.vscode\extensions\jbenden.c-cpp-flylint-1.10.2\server\out\server.js:2:13054)
    at c:\Users\xj\.vscode\extensions\jbenden.c-cpp-flylint-1.10.2\server\out\server.js:2:22064
    at Array.forEach (<anonymous>)
    at L (c:\Users\xj\.vscode\extensions\jbenden.c-cpp-flylint-1.10.2\server\out\server.js:2:22039)

If I set c-cpp-flylint.language to C++ language, the above error disappears.

So how to cope with this error when c-cpp-flylint.language is set to C language?

Try to set c-cpp-flylint.standard to c11.

@jbenden Thanks! It works.

A new question: in my code, there are some Chinese characters. Therefore, the plugin gives vscode-c-cpp-flylint: 'Line could not be parsed: Error: encoding error in ... error. I guess this is related to the Chinese characters and the encoding. The text encoding of my vscode editor is utf-8. I haven't found any setting related to encoding.

Hi,

Would you please enable debugging (c-cpp-flylint.debug setting) and post the full log shown in the "C/C++ Flylint" output window? I am not sure where in the code it would give this error message. I believe I've specified "utf-8" encoding where possible...

Thanks,
-Joe

onDidOpen starting analysis.
Incoming request for isTrusted property. Have true.
Skipping analysis because ON_SAVE !== ON_TYPE.
Path: ${workspaceFolder}/**  VALUE: c:\Users\xj\cpp\iup-learning/**  Globbed is: 
c:\Users\xj\cpp\iup-learning\example3_7.c force = false.
c:\Users\xj\cpp\iup-learning\example3_7.c is now at version number 1.
Performing lint scan of c:\Users\xj\cpp\iup-learning\example3_7.c...
executing:  C:\msys2\mingw64\bin\clang.EXE -fsyntax-only -fno-color-diagnostics -fno-caret-diagnostics -fno-diagnostics-show-option -fdiagnostics-show-category=name -ferror-limit=200 --std=c11 -fblocks -Wall -Wextra -I C:/Users/xj/pkg/cd/include -I C:/Users/xj/pkg/iup/include -x c c:\Users\xj\cpp\iup-learning\example3_7.c
[ '' ]
[ '' ]
executing:  C:\msys2\mingw64\bin\cppcheck.EXE --inline-suppr --enable=warning,style,performance,portability,information --std=c11 --std=c++11 --language=c --platform=native --template="{file}  {line}  {severity} {id}: {message}" c:\Users\xj\cpp\iup-learning\example3_7.c
[ 'Checking c:\\Users\\xj\\cpp\\iup-learning\\example3_7.c ...', '' ]
[
  '"nofile  0  information missingIncludeSystem: Cppcheck cannot find all the include files (use --check-config for details)"',
  ''
]
executing:  C:\Users\xj\AppData\Local\Programs\Python\Python39\Scripts\flawfinder.EXE --columns --dataonly --singleline c:\Users\xj\cpp\iup-learning\example3_7.c
[
  'Examining c:\\Users\\xj\\cpp\\iup-learning\\example3_7.c',
  'Error: encoding error in c:\\Users\\xj\\cpp\\iup-learning\\example3_7.c',
  "'gbk' codec can't decode byte 0xaf in position 1667: illegal multibyte sequence",
  '',
  'Python3 requires input character data to be perfectly encoded;',
  'it also requires perfectly correct system encoding settings.',
  'Unfortunately, your data and/or system settings are not.',
  'Here are some options:',
  '1. Run: PYTHONUTF8=0 python3 flawfinder',
  '   if your system and and data are all properly set up for',
  '   a non-UTF-8 encoding.',
  '2. Run: PYTHONUTF8=0 LC_ALL=C.ISO-2022 python3 flawfinder',
  '   if your data has a specific encoding such as ISO-2022',
  '   (replace "ISO-2022" with the name of your encoding,',
  '   and optionally replace "C" with your native language).',
  '3. Run: PYTHONUTF8=0 LC_ALL=C.ISO-8859-1 python3 flawfinder',
  '   if your data has an unknown or inconsistent encoding',
  '   (ISO-8859-1 encoders normally allow anything).',
  '4. Convert all your source code to the UTF-8 encoding.',
  '   The system program "iconv" or Python program "cvt2utf" can',
  '   do this (for cvt2utf, you can use "pip install cvt2utf").',
  '5. Run: python2 flawfinder',
  '   (That is, use Python 2 instead of Python 3).',
  'Some of these options may not work depending on circumstance.',
  'In the long term, we recommend using UTF-8 for source code.',
  'For more information, see the documentation.',
  ''
]
[ '' ]
FlawFinder exited with status code 15
executing:  C:\Users\xj\AppData\Local\Programs\Python\Python39\Scripts\lizard.EXE --warnings_only c:\Users\xj\cpp\iup-learning\example3_7.c
[ '' ]
[ '' ]
Completed lint scans...

The full log shows Flawfinder gives the error. When I disable Flawfinder, the error disappears.

Hello,

A new extension was just published a minute ago. If you still experience this problem, then please capture a full debugging log and post it here. In the extension's settings you may enable debug and verbose.

I am hoping that UTF-8 pass-through will occur now...

Thanks,
-Joe