Function: semantic-gcc-get-include-paths
semantic-gcc-get-include-paths is a byte-compiled function defined in
gcc.el.gz.
Signature
(semantic-gcc-get-include-paths LANG)
Documentation
Return include paths as gcc uses them for language LANG.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/gcc.el.gz
;;(semantic-gcc-get-include-paths "c")
;;(semantic-gcc-get-include-paths "c++")
(defun semantic-gcc-get-include-paths (lang)
"Return include paths as gcc uses them for language LANG."
(let* ((gcc-cmd (cond
((string= lang "c") "gcc")
((string= lang "c++") "c++")
(t (if (stringp lang)
(error "Unknown lang: %s" lang)
(error "LANG=%S, should be a string" lang)))))
(gcc-output (semantic-gcc-query gcc-cmd "-v" "-E" "-x" lang null-device))
(lines (split-string gcc-output "\n"))
(include-marks 0)
(inc-mark "#include ")
(inc-mark-len (length "#include "))
inc-path)
;;(message "gcc-output=%s" gcc-output)
(dolist (line lines)
(when (> (length line) 1)
(if (= 0 include-marks)
(when (and (> (length line) inc-mark-len)
(string= inc-mark (substring line 0 inc-mark-len)))
(setq include-marks (1+ include-marks)))
(let ((chars (append line nil)))
(when (= 32 (nth 0 chars))
(let ((path (substring line 1)))
(when (and (file-accessible-directory-p path)
(file-name-absolute-p path))
(cl-pushnew (expand-file-name path) inc-path
:test #'equal))))))))
(nreverse inc-path)))