Skip to content

Commit

Permalink
lib: handle visual studio code C/C++ extension
Browse files Browse the repository at this point in the history
Add some `pragma`s to handle errors that the C/C++ extension is not able
to understand.

Signed-off-by: Rafael Zalamena <[email protected]>
  • Loading branch information
rzalamena committed Nov 24, 2022
1 parent d15c84f commit ed5ee33
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ struct memgroup {
} \
MACRO_REQUIRE_SEMICOLON() /* end */

#ifdef __INTELLISENSE__
/*
* Fix Visual Studio Code error: attribute "constructor" does not take
* arguments.
*
* Caused by the macro `DEFINE_MTYPE_ATTR`.
*/
#pragma diag_suppress 1094
#endif /* __INTELISENSE__ */

#define DEFINE_MTYPE(group, name, desc) \
DEFINE_MTYPE_ATTR(group, name, , desc) \
/* end */
Expand Down
11 changes: 11 additions & 0 deletions lib/prefix.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,17 @@ union prefixconstptr {
prefixtype(prefixconstptr, const struct prefix_rd, rd)
} TRANSPARENT_UNION;

#ifdef __INTELLISENSE__
/*
* Fix Visual Studio Code error: argument of type "struct prefix *" is
* incompatible with parameter of type "union prefixptr".
*
* This is caused by all functions having the transparent unions in the
* prototype: `prefixptr` and `prefixconstptr`.
*/
#pragma diag_suppress 167
#endif /* __INTELISENSE__ */

#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif /* INET_ADDRSTRLEN */
Expand Down

0 comments on commit ed5ee33

Please sign in to comment.