Skip to content

Instantly share code, notes, and snippets.

View compile_commands.mk
#example for generating compile_commands.json for a simple Makefile
# variables:
# CURDIR (make builtin) the CWD of the make process (build directory)
# / the project root - we're assuming the Makefile lives there
# CC the C compiler
# CFLAGS C compiler flags
# C_SRCS list of .c files that are built
/ := $(dir $(lastword $(MAKEFILE_LIST)))
View gist:9f437dd273392e8e13e0c75125859693
## I had to explicitly add gcc's include paths, otherwise it wouldn't find the C stdlib headers (even though I placed my clang=query in /usr/bin)
## to find out what to add in your case, see the output of:
# echo | g++ -E -Wp,-v -
## which, in my case, gives:
## ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.1/../../../../x86_64-pc-linux-gnu/include"
## #include "..." search starts here:
## #include <...> search starts here:
## /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.1/include
## /usr/local/include
View query.json
This file has been truncated, but you can view the full file.
[
{
"binding": "root",
"location": "/home/swym/tmp/eater/openmw-tes3mp/apps/openmw-mp/Script/ScriptFunctions.hpp:120:5",
"ast": {
"id": "0x7f1a9a7af238",
"kind": "VarDecl",
"loc": {
"offset": 3657,
@0xfd000000
0xfd000000 / defs.h
Last active Jan 14, 2018
Generate x-macro header from linux/input-event-codes.h
View defs.h
#define KEY(a,b) KEY.a = b
#define BTN(a,b) BTN.a = b
#define LED(a,b) LED.a = b
#define REP(a,b) REP.a = b
#define SND(a,b) SND.a = b
#define MSC(a,b) MSC.a = b
#define SW(a,b) SW.a = b
#define ABS(a,b) ABS.a = b
#define EV(a,b) EV.a = b
#define SYN(a,b) SYN.a = b