wip vscode intellisense support

This commit is contained in:
Alexander Nicholi 2021-02-02 07:29:00 -05:00
parent 3ab76b2312
commit 9841e2186a
No known key found for this signature in database
GPG key ID: B75B2EB05540F74C
5 changed files with 92 additions and 2 deletions

View file

@ -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) \
({ \

View file

@ -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)

View file

@ -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));

View file

@ -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