Created
December 18, 2011 15:04
-
-
Save mooz/1493649 to your computer and use it in GitHub Desktop.
My flymake settings for C/C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; just an example | |
((c++-mode . ((flymake-additional-compilation-flags . ("-I../" "-std=c++0x"))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar flymake-additional-compilation-flags nil) | |
(put 'flymake-additional-compilation-flags 'safe-local-variable 'listp) | |
;; no need to arrange Makefile | |
(defun flymake-cc-init () | |
(let* ((temp-file (flymake-init-create-temp-buffer-copy | |
'flymake-create-temp-inplace)) | |
(local-file (file-relative-name | |
temp-file | |
(file-name-directory buffer-file-name))) | |
(common-args (append (list "-Wall" "-W" "-fsyntax-only" local-file) | |
flymake-additional-compilation-flags))) | |
(if (eq major-mode 'c++-mode) | |
(list "g++" common-args) | |
(list "gcc" common-args)))) | |
(loop for ext in '("\\.c$" "\\.h$" "\\.cc$" "\\.cpp$" "\\.hh$") | |
do | |
(push `(,ext flymake-cc-init) flymake-allowed-file-name-masks)) | |
(add-hook 'c-mode-hook (lambda () (flymake-mode t))) | |
(add-hook 'c++-mode-hook (lambda () (flymake-mode t))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment