How does flycheck or any other linter that uses compile_commands.json find the sources of the standard library? How do they determine the language standard? By the standard flag specified for clang or otherwise? Can I just change this flag in compile_commands.json, say c++11 change to c++17 and errors related to the absence of some std::optional will disappear, because it will pull them up? Provided, of course, that the code has been compiled and the compile_commands file has already been generated! Does the compiler affect these sources? I.e. the clang/clang++ compiler of some unreal engine that he has in his directory is a heavily modified version, what will happen if I change the compiler it was built with to a compiler from UE sources in compile_commands, for a project that is not related to UE at all and uses the 17th standard at all?
how do linters (flycheck) work with compile_commands file?
89 Views Asked by HamsterGamer At
1
There are 1 best solutions below
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in EMACS
- How can I make 'emacsclient' open in native fullscreen every time I launch it from the terminal in macOS?
- emacsclient does not connect inside ubuntu container
- Emacs use .emacs by default instead .emacs.d/init.el
- Setting up Macaulay 2 on emacs
- org-mime add caption to exported images
- Use the same export attribute for all src-blocks
- Tags Development Tools
- Emacs 29.2 unable to find theme file
- How to automatically allow the execution of code action from HLS in emacs?
- Org-babel remote inline images with TRAMP not exporting in org export
- find and replace regex like that can deal with nested brackets
- Inheriting from variadic types messes up template member function indentation in Emacs
- Invoking org-store-link interactively, errors on calling org-man-store-link
- Disable session save in doom emacs
- How do you connect to a remote emacs server using Microsoft dev tunnels
Related Questions in LINTER
- Python Linter to catch user shadowed function names
- Difference Between Linter, Sanitizer and Analyzers
- ! Linter 'object_length_linter' failed in : path[1]="": no such file or directory in R extension in vscode
- Disable linter error of `method is not a known member of module "cv2"` from pylance in VSCode
- commit-msg-linter.js: no such file or directory error
- Configure Linter and Prettier for HTML rule implementations
- Resolving Type Support Errors in Polars Series
- Type hint in parent class that take child class as argument
- Visual Studio Code Python Linter is highlighting "problems". How do I disable This?
- VS Code + JavaScript + eslint show error when calling an object with invalid key
- Why isn't my Ionic React app linter producing any output?
- Unable to find qualified name for module: main.py — what does in mean?
- Python: Select linter isn't showing on the command palette on VScode
- Which linter prompts warning/error in VSC
- exclude migrations files from flake8 and black in github actions
Related Questions in FLYCHECK
- how do linters (flycheck) work with compile_commands file?
- Upgraded emacs to 28.2, flycheck fails: undefined elisp macros
- emacs flycheck (bash with shellcheck) throws error when using optional characters
- Mypy Flycheck Clears Errors On Unsaved File
- Emacs: Gloabally disable flycheck/prettier temporarily
- Calling (require ...) on a MELPA installed package gives FlyCheck error "Cannot open load file"
- Emacs - Python LSP setup.cfg not honored
- How do I load the flask-sqlalchemy plugin for flycheck (pylint) on Emacs?
- How can flycheck give warning if the object's function does not exist?
- Force flycheck mode to turn off in emacs when working with remote (tramp) python files but not locally
- Emacs flycheck package installation
- Flycheck warning in Emacs’ *Messages* buffer are not displayed correctly
- Emacs - ccls : no member named "filesystem" in namespace "std"
- How to see what the red squiggly error marking indicates
- flycheck-irony installation on emacs
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I think you misunderstand the role of the file. The file is not generated by the compiler, but by the build tools. It does not imply the compilation took place at all and it is not passed to the compiler.
compile_commands.jsonstores the exact commands which the build tool will execute during build, no less and no more.The linters should do whatever the called compilers would have done if passed the same flags. That is of course non-trivial. Some linters might only look for specific flags, some might do more work. The LLVM toolset is very well integrated with the file - clang-tidy and clangd both use it heavily and they have the internal knowledge of what clang would do. But for most linters I would assume the important flags are the include paths and the language standard.
The same way the compiler does - there are system paths where the standard library is searched for.
From the
-std=XXXflags.Yes, because as far as the linter knows, you would use c++17 during your build.
No,
compile_commands.jsonis not generated by the compiler as explained earlier. The file could be used to invoke the build commands.Then again, the linter would believe that is the compiler you intent to compile your code with, whether that is something the linter cares about is another thing.