1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-10 08:10:21 -08:00

Fix finding C headers with clang

This fixes following "#include" references in 'M-x man' buffers, and
using ffap, both on macOS machines, and on systems where for some reason
clang is available but gcc is not.

* lisp/subr.el (internal--c-header-file-path): Fix finding C
headers with clang.
(internal--gcc-is-clang-p): New function factored out from...
* lisp/emacs-lisp/ert-x.el (ert-gcc-is-clang-p): ...here.
* lisp/man.el (Man-header-file-path): Bump :version tag.

* test/lisp/subr-tests.el
(subr-tests-internal--c-header-file-path/clang-mocked): New test.
This commit is contained in:
Stefan Kangas 2025-01-06 12:29:21 +01:00
parent 888ff3755d
commit 3dc3dbc2e3
4 changed files with 82 additions and 16 deletions

View file

@ -526,11 +526,7 @@ The same keyword arguments are supported as in
(defun ert-gcc-is-clang-p ()
"Return non-nil if the `gcc' command actually runs the Clang compiler."
;; Some macOS machines run llvm when you type gcc. (!)
;; We can't even check if it's a symlink; it's a binary placed in
;; "/usr/bin/gcc". So we need to check the output.
(string-match "Apple \\(LLVM\\|[Cc]lang\\)\\|Xcode\\.app"
(shell-command-to-string "gcc --version")))
(internal--gcc-is-clang-p))
(defvar tramp-default-host-alist)
(defvar tramp-methods)