Giter Site home page Giter Site logo

flycheck-clangcheck's Introduction

flycheck-clangcheck

http://melpa.org/packages/flycheck-clangcheck-badge.svg

A Flycheck checker difinition for ClangCheck.

Installation

Prerequisites

  • clang-check (this is part of clang.)

Setup

  1. Install:

    MELPA:

    http://melpa.org/packages/flycheck-clangcheck-badge.svg

    or clone this repository:

    $ git clone https://github.com/kumar8600/flycheck-clangcheck
        
  2. Add settings for ~/.emacs.d/init.el:
    (add-to-list 'load-path "/path/to/flycheck-clangcheck") ;; if you installed manually
    (require 'flycheck-clangcheck)
    
    (defun my-select-clangcheck-for-checker ()
      "Select clang-check for flycheck's checker."
      (flycheck-set-checker-executable 'c/c++-clangcheck
                                       "/path/to/clang-check")
      (flycheck-select-checker 'c/c++-clangcheck))
    
    (add-hook 'c-mode-hook #'my-select-clangcheck-for-checker)
    (add-hook 'c++-mode-hook #'my-select-clangcheck-for-checker)
    
    ;; enable static analysis
    (setq flycheck-clangcheck-analyze t)
        

Customizable variables

flycheck-clangcheck-analyze
Whether to enable Static Analysis to C/C++ in ClangCheck.
flycheck-clangcheck-extra-arg
Additional argument to append to the compiler command line for ClangCheck.
flycheck-clangcheck-extra-arg-before
Additional argument to prepend to the compiler command line for ClangCheck.
flycheck-clangcheck-fatal-assembler-warnings
Whether to enable Considering warning as error to C/C++ in ClangCheck.
flycheck-clangcheck-dbname
The name of the JSON Compilation Database (default compile_commands.json).
flycheck-clangcheck-build-path
Build directory for ClangCheck. If this is defined, a JSON Compilation Database (flycheck-clangcheck-dbname) must be placed to there.

flycheck-clangcheck's People

Contributors

kumar8600 avatar stsquad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flycheck-clangcheck's Issues

Current Working Directory Problems

Not sure if this has already been mentioned, but when using clang check, my current working directory doesn't change after opening a file.

in Emacs if I:

  1. cd to ~/projects/myproject
  2. open file ~/projects/myproject/src/test.cpp

My current directory still remains ~/projects/myproject
Though it should be ~/projects/myproject/src/ while looking at the test.cpp buffer. This is not a huge deal as I can just 'cd' into src, but it isn't the default emacs behaviour when dealing with current buffer working directories and causes issues with switching between h/cpp files. If my project had a more complicated src structure (as most projects do), this would be problematic as it would be a huge pain to have to 'cd' all the time after opening files.

This only becomes an issue after enabling flycheck-clangcheck and not with flycheck alone.

Read through some of the code and saw that "default-directory" is being set, is this so that the package can read compile_commands.json regardless of the current buffer? Is it not possible to keep track of the compile_commands.json directory without overwriting the default-directory?

Problematic issues with build directories

Due to the way the builder works around calling clang-check directly it will get confused by not being in the right build directory (e.g. in QEMU it fails to find config-target.h which is in the target build directory). I'm working on a fix to pass the build directory as an option.

Flycheck generating plist garbage files

It seems while using this extension, all these annoying plist files magically appear in my source directory. For example flycheck_pixel_parse.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>clang_version</key>
<string>Ubuntu clang version 3.6.0-2ubuntu1~trusty1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)</string>
 <key>files</key>
 <array>
 </array>
 <key>diagnostics</key>
 <array>
 </array>
</dict>
</plist>

C++11 Support

In order to get this to work on C++11 sources I had to use (setq flycheck-clangcheck-extra-arg '("-std=c++11")). Perhaps this module should pass that information along based on the flycheck-clang-language-standard customization?

JSON Compilation Database not work

Hi, I have a JSON Database Compilation and it works well from the terminal.

[
    {
        "directory": "./",
        "command": "clang ./src/lab14.c -std=c99 -Wall  -I./include -o ./bin/setup.exe",
        "file": "C:/Users/nxjulian/Documents/lab14/src/lab14.c"
    }
]

Terminal

clang-check -analyze src/lab14.c

With emacs

(require 'flycheck-clangcheck)
(defun my-select-clangcheck-for-checker ()
  "Select clang-check for flycheck's checker."
  (flycheck-mode 1)
  (flycheck-set-checker-executable 'c/c++-clangcheck
                                   "C:/Program Files/LLVM/bin/clang-check.exe")
  (flycheck-select-checker 'c/c++-clangcheck))

The problem is in emacs with flycheck-clangcheck not recognize "./include".

Help me please.

Could we tag a stable version?

As there isn't much development going on now can we tag a stable version so a pinned version can be added to melpa-stable?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.