diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 00000000..bee9294f --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,76 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}" + ], + "cStandard": "c11", + "cppStandard": "c++11", + "compilerPath": "${workspaceFolder}/o/third_party/gcc/bin/x86_64-linux-musl-gcc", + "defines": [ + "__VSCODE_INTELLISENSE__", + "__BIGGEST_ALIGNMENT__", + "__SHRT_MAX__", + "__DBL_MIN__", + "__UINT32_MAX__", + "NULL=(void*)0", + "true", + "false=(!(true))", + "COSMOPOLITAN_C_START_=", + "COSMOPOLITAN_C_END_=", + "libcesque=", + "mallocesque=", + "pureconst=", + "paramsnonnull(x)=", + "alignas(x)", + "alignof(x)", + "artificial=", + "nodiscard=", + "mayalias=", + "_Vector_size(x)=", + "forceinline=", + "forcealign(x)=", + "wontreturn=", + "textreal=", + "vallocesque=", + "nosideeffect=", + "unreachable=", + "thatispacked=", + "nothrow=", + "nocallback=", + "relegated=", + "hidden=", + "textstartup=", + "initarray=", + "returnsnonnull=", + "returnspointerwithnoaliases=", + "printfesque(x)=", + "attributeallocsize(x)=", + "va_list=void*", + "returnsaligned(x)=", + "attributeallocalign(x)=", + "nullterminated(x)=", + "PAGESIZE", + "g_loglevel", + "int8_t=signed char", + "int16_t=signed short int", + "int32_t=signed int", + "int64_t=signed long long", + "uint8_t=unsigned char", + "uint16_t=unsigned short int", + "uint32_t=unsigned int", + "uint64_t=unsigned long long", + "errno_t=int", + "size_t=uint64_t", + "ssize_t=int64_t", + "uintptr_t=uint64_t", + "intptr_t=int64_t", + "bool=uint8_t", + "char16_t=uint16_t", + "char32_t=uint32_t" + ] + } + ], + "version": 4 +} diff --git a/libc/bits/safemacros.h b/libc/bits/safemacros.h index f9a3eabc..d7b839b6 100644 --- a/libc/bits/safemacros.h +++ b/libc/bits/safemacros.h @@ -16,7 +16,8 @@ const char *emptytonull(const char *); const char *firstnonnull(const char *, const char *); uint64_t(unsignedsubtract)(uint64_t, uint64_t) pureconst; -#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) && \ +!defined(__VSCODE_INTELLISENSE__) #define min(x, y) \ ({ \ diff --git a/libc/log/check.h b/libc/log/check.h index 38ef2636..f7b0b0f7 100644 --- a/libc/log/check.h +++ b/libc/log/check.h @@ -47,6 +47,9 @@ COSMOPOLITAN_C_START_ VAR = (typeof(VAR))__builtin_assume_aligned(VAR, BYTES); \ } while (0) +#if defined(__VSCODE_INTELLISENSE__) +#define __CHK(...) +#else #define __CHK(SUFFIX, OP, WANT, WANTSTR, GOT, GOTSTR, ...) \ do { \ autotype(GOT) Got = (GOT); \ @@ -61,7 +64,11 @@ COSMOPOLITAN_C_START_ unreachable; \ } \ } while (0) +#endif /* defined(__VSCODE_INTELLISENSE__) */ +#if defined(__VSCODE_INTELLISENSE__) +#define __DCHK(...) +#else #ifdef NDEBUG #define __DCHK(SUFFIX, OP, WANT, WANTSTR, GOT, ...) \ do { \ @@ -74,7 +81,8 @@ COSMOPOLITAN_C_START_ #else #define __DCHK(SUFFIX, OP, WANT, WANTSTR, GOT, GOTSTR, ...) \ __CHK(SUFFIX, OP, WANT, WANTSTR, GOT, GOTSTR, __VA_ARGS__) -#endif +#endif /* NDEBUG */ +#endif /* defined(__VSCODE_INTELLISENSE__) */ #ifdef NDEBUG #define __DCHK_ALIGNED(BYTES, VAR) diff --git a/libc/runtime/gc.h b/libc/runtime/gc.h index 46aec7c4..9ca8bec9 100644 --- a/libc/runtime/gc.h +++ b/libc/runtime/gc.h @@ -30,6 +30,7 @@ void gclongjmp(jmp_buf, int) nothrow wontreturn paramsnonnull(); /** * Calls FN(ARG) when function returns. */ +#ifndef __VSCODE_INTELLISENSE__ #define defer(FN, ARG) \ ({ \ autotype(ARG) Arg = (ARG); \ @@ -39,6 +40,7 @@ void gclongjmp(jmp_buf, int) nothrow wontreturn paramsnonnull(); asm volatile("" : "+g"(Arg) : : "memory"); \ Arg; \ }) +#endif /* __VSCODE_INTELLISENSE__ */ void __defer(struct StackFrame *, void *, void *) hidden paramsnonnull((1, 2)); diff --git a/libc/runtime/symbolic.h b/libc/runtime/symbolic.h index 8a6280a8..8edbb825 100644 --- a/libc/runtime/symbolic.h +++ b/libc/runtime/symbolic.h @@ -6,6 +6,9 @@ #define SYMBOLIC(NAME) NAME(%rip) #define LITERALLY(NAME) $NAME /* clang-format on */ +#elif defined(__VSCODE_INTELLISENSE__) +#define SYMBOLIC(NAME) 1 +#define LITERALLY(NAME) 1 #else #define SYMBOLIC(NAME) NAME #define LITERALLY(NAME) NAME