From: Ke Du <duke@naive.systems>
To: luc.vanoostenryck@gmail.com
Cc: linux-sparse@vger.kernel.org, Ke Du <duke@naive.systems>,
Xiao Jia <xjia@naive.systems>
Subject: [PATCH 1/2] expose more functions to C++ in header files
Date: Thu, 12 Aug 2021 20:25:10 -0500 [thread overview]
Message-ID: <20210813012511.65397-2-duke@naive.systems> (raw)
In-Reply-To: <20210813012511.65397-1-duke@naive.systems>
Delete or shrink the ifndef __cplusplus guard to expose more facilities
to C++, such as sparse_initialize and the FOR_EACH_PTR macro.
Signed-off-by: Ke Du <duke@naive.systems>
Reviewed-by: Xiao Jia <xjia@naive.systems>
---
lib.h | 4 ++--
ptrlist.h | 2 +-
symbol.h | 3 ---
token.h | 3 +--
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib.h b/lib.h
index 9809feee..0e9bd0cd 100644
--- a/lib.h
+++ b/lib.h
@@ -85,8 +85,6 @@ DECLARE_PTR_LIST(string_list, char);
typedef struct pseudo *pseudo_t;
-#ifndef __cplusplus
-
#ifdef __GNUC__
#define FORMAT_ATTR(pos) __attribute__ ((__format__ (__printf__, pos, pos+1)))
#define NORETURN_ATTR __attribute__ ((__noreturn__))
@@ -143,6 +141,8 @@ extern struct symbol_list *sparse_keep_tokens(char *filename);
extern struct symbol_list *sparse(char *filename);
extern void report_stats(void);
+#ifndef __cplusplus
+
static inline int symbol_list_size(struct symbol_list *list)
{
return ptr_list_size((struct ptr_list *)(list));
diff --git a/ptrlist.h b/ptrlist.h
index e281309f..67c7a208 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -109,6 +109,7 @@ extern void __free_ptr_list(struct ptr_list **);
DO_REVERSE(ptr, __head##ptr, __list##ptr, __nr##ptr, __rname##new, \
new, __head##new, __list##new, __nr##new, PTR_ENTRY_UNTAG)
+#endif // __cpluplus
#define FOR_EACH_PTR(head, ptr) \
DO_FOR_EACH(head, ptr, __head##ptr, __list##ptr, __nr##ptr, __name##ptr, PTR_ENTRY_NOTAG)
@@ -311,5 +312,4 @@ static inline void *tag_ptr(void *ptr, unsigned long tag)
return (void *)(tag | (unsigned long)ptr);
}
-#endif // __cpluplus
#endif /* PTR_LIST_H */
diff --git a/symbol.h b/symbol.h
index 503c9f09..c9d221e7 100644
--- a/symbol.h
+++ b/symbol.h
@@ -220,8 +220,6 @@ struct symbol {
pseudo_t pseudo;
};
-#ifndef __cplusplus
-
/* Modifiers */
#define MOD_AUTO 0x00000001
#define MOD_REGISTER 0x00000002
@@ -591,5 +589,4 @@ static inline void combine_address_space(struct position pos,
}
}
-#endif // __cplusplus
#endif /* SYMBOL_H */
diff --git a/token.h b/token.h
index 1f3601a9..804cc6f8 100644
--- a/token.h
+++ b/token.h
@@ -197,7 +197,7 @@ struct token {
};
};
-#ifndef __cplusplus
+
#define MAX_STRING 8191
@@ -251,5 +251,4 @@ static inline int match_token_zero(struct token *token)
return token->number[0] == '0' && !token->number[1];
}
-#endif // __cplusplus
#endif
--
2.31.1
next prev parent reply other threads:[~2021-08-13 1:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-22 6:45 check idea: include sparse as a library in C++ Ke Du
2021-07-26 18:28 ` Luc Van Oostenryck
2021-08-13 1:25 ` [PATCH 0/2] fixes for using sparse as a C++ library Ke Du
2021-08-13 1:25 ` Ke Du [this message]
2021-11-17 9:44 ` [PATCH 1/2] expose more functions to C++ in header files Xiao Jia
2021-08-13 1:25 ` [PATCH 2/2] make implicit type conversion explicit Ke Du
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210813012511.65397-2-duke@naive.systems \
--to=duke@naive.systems \
--cc=linux-sparse@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.com \
--cc=xjia@naive.systems \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).