linter-gcc icon indicating copy to clipboard operation
linter-gcc copied to clipboard

linter-gcc can't read property from .gcc-flags.json

Open ghost opened this issue 8 years ago • 4 comments

Checklist

  • [✓] Check that you have the GNU C Compiler installed by typing gcc --version into a terminal.
  • [✓] If you don't have the linter package installed, either update to the latest version of linter-gcc or install linter directly with apm install linter.
  • [✓] Ensure that you are using a valid grammar - either C/C++/C++14
  • [✓] Ensure that you have read all the relevant information in the wiki, particularly the Common Issues page.

Issue (including debugging messages):

I have gcc and avr-gcc installed, avr-gcc not localized and his messages in english, but gcc is localized, his messages in ukrainian. So, i change the default "String GCC prepends to errors", "String GCC prepends to warnings" and "String GCC prepends to notes" in settings according to my LC_MESSAGES and create .gcc-flags.json file with parameters for avr-gcc project in project root directory. The problem is that: adding "gccErrorString", "gccWarningString" and "gccNoteString" with default (English) values for avr-gcc to .gcc-flags.json not give desired effect, linter is working, but can not parse output correctly (if have errors, linter show only first), but if set back this parameters in settings avr-gcc works fine.

P. S. I found a solution, that works, but I know that's not right and don't know how to make it better. main.zip

linter-gcc v0.7.1

debugging messages:

linter-gcc: Reading settings from: /home/zombien/Documents/HW_projects/nixieclock/.gcc-flags.json utility.js:130 linter-gcc config: {"execPath":"/usr/bin/avr-gcc","gccIncludePaths":"., /usr/avr/include/*","gccSuppressWarnings":false,"gccDefaultCFlags":"-c -Wall -fsyntax-only -Wno-main -mmcu=atmega8 -Os -o /dev/null","gccDefaultCppFlags":"-c -Wall -fsyntax-only -Wno-main -std=c++11 -mmcu=atmega8 -Os -o /dev/null","gccErrorLimit":-1,"gccErrorString":"error","gccWarningString":"warning","gccNoteString":"note","compileCommandsFile":"./build/compile_commands.json"} utility.js:142 /home/zombien/Documents/HW_projects/nixieclock/build/compile_commands.json utility.js:111 Expanding directories utility.js:208 linter-gcc: /usr/bin/avr-gcc -c -Wall -fsyntax-only -Wno-main -mmcu=atmega8 -Os -o /dev/null -I/home/zombien/Documents/HW_projects/nixieclock -I/usr/avr/include/avr -I/usr/avr/include/compat -I/usr/avr/include/sys -I/usr/avr/include/util -I/usr/avr/include /tmp/f156993b-cf7b-4fad-9403-6f82c0c320c6.c

content of error panel:

GCC ERROR /tmp/f83e4e23-a9cb-4b61-8dd5-71ba8bafa193.c: In function 'main': /tmp/f83e4e23-a9cb-4b61-8dd5-71ba8bafa193.c:11:2: error: expected ';' before 'array' array[0] = 0x00; ^~~~~~~~~ /tmp/f83e4e23-a9cb-4b61-8dd5-71ba8bafa193.c:16:2: error: expected ';' before 'twi_init' twi_init(); ^~~~~~~~

ghost avatar Jan 27 '17 01:01 ghost

Thanks for raising the issue. I've just had a look at your fix, and the solution is simple - add the localized strings to .gcc-flags.json, as optional parameters. If they're missing, we use the configuration page settings. What do you think?

hebaishi avatar Jan 27 '17 20:01 hebaishi

This is my file, I'm already add the localized strings! according to console, localized strings is loaded, but does not give any effect

.gcc-flags.json { "execPath": "/usr/bin/avr-gcc", "gccDefaultCFlags": "-c -Wall -fsyntax-only -Wno-main -mmcu=atmega8 -Os -o /dev/null", "gccDefaultCppFlags": "-c -Wall -fsyntax-only -Wno-main -std=c++11 -mmcu=atmega8 -Os -o /dev/null", "gccErrorLimit": -1, "gccErrorString": "error", "gccWarningString": "warning", "gccNoteString": "note", "gccIncludePaths": "., /usr/avr/include/*", "gccSuppressWarnings": false }

ghost avatar Jan 27 '17 21:01 ghost

Yes I see that now. The code in config.js needs to change to read the localised strings from .gcc-flags.json. Will make the change in the next release. I need to add some tests to cover this new feature.

hebaishi avatar Jan 27 '17 21:01 hebaishi

Okay, thank you)

ghost avatar Jan 27 '17 21:01 ghost