[PATCH 1/2] expose more functions to C++ in header files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux