Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jdesfossez@efficios.com (Julien Desfossez)
Subject: [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro
Date: Thu, 24 Jan 2013 16:21:33 -0500	[thread overview]
Message-ID: <1359062510-7557-1-git-send-email-jdesfossez@efficios.com> (raw)

This macro will be used across the codebase to set the visibility of a
function to hidden.
Updated also the functions that were setting the attribute manually.

Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
 formats/ctf/metadata/ctf-lexer.l         |    2 +-
 formats/ctf/metadata/ctf-parser.y        |   22 +++++++++++-----------
 formats/ctf/metadata/ctf-scanner.h       |    2 +-
 include/babeltrace/babeltrace-internal.h |    5 +++++
 4 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/formats/ctf/metadata/ctf-lexer.l b/formats/ctf/metadata/ctf-lexer.l
index 26aa1bc..2209a86 100644
--- a/formats/ctf/metadata/ctf-lexer.l
+++ b/formats/ctf/metadata/ctf-lexer.l
@@ -31,7 +31,7 @@
 #include "ctf-parser.h"
 #include "ctf-ast.h"
 
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 void setstring(struct ctf_scanner *scanner, YYSTYPE *lvalp, const char *src);
 
 static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
diff --git a/formats/ctf/metadata/ctf-parser.y b/formats/ctf/metadata/ctf-parser.y
index e7dfd80..72b0978 100644
--- a/formats/ctf/metadata/ctf-parser.y
+++ b/formats/ctf/metadata/ctf-parser.y
@@ -39,7 +39,7 @@
 #include "ctf-parser.h"
 #include "ctf-ast.h"
 
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 int yydebug;
 
 /* Join two lists, put "add" at the end of "head".  */
@@ -55,15 +55,15 @@ _bt_list_splice_tail (struct bt_list_head *add, struct bt_list_head *head)
 	}
 }
 
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 int yyparse(struct ctf_scanner *scanner);
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 int yylex(union YYSTYPE *yyval, struct ctf_scanner *scanner);
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 int yylex_init_extra(struct ctf_scanner *scanner, yyscan_t * ptr_yy_globals);
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 int yylex_destroy(yyscan_t yyscanner);
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 void yyrestart(FILE * in_str, yyscan_t scanner);
 
 struct gc_string {
@@ -101,7 +101,7 @@ static const char *node_type_to_str[] = {
 	[ NODE_STRUCT ] = "NODE_STRUCT",
 };
 
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 const char *node_type(struct ctf_node *node)
 {
 	if (node->type < NR_NODE_TYPES)
@@ -132,7 +132,7 @@ static struct gc_string *gc_string_alloc(struct ctf_scanner *scanner,
  * gsrc will be garbage collected immediately, and gstr might be.
  * Should only be used to append characters to a string literal or constant.
  */
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 struct gc_string *gc_string_append(struct ctf_scanner *scanner,
 				   struct gc_string *gstr,
 				   struct gc_string *gsrc)
@@ -211,7 +211,7 @@ static int lookup_type(struct ctf_scanner_scope *s, const char *id)
 	return ret;
 }
 
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 int is_type(struct ctf_scanner *scanner, const char *id)
 {
 	struct ctf_scanner_scope *it;
@@ -815,13 +815,13 @@ static int set_parent_node(struct ctf_node *node,
 	return 0;
 }
 
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 void yyerror(struct ctf_scanner *scanner, const char *str)
 {
 	fprintf(stderr, "error %s\n", str);
 }
  
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 int yywrap(void)
 {
 	return 1;
diff --git a/formats/ctf/metadata/ctf-scanner.h b/formats/ctf/metadata/ctf-scanner.h
index d5650d0..21010fd 100644
--- a/formats/ctf/metadata/ctf-scanner.h
+++ b/formats/ctf/metadata/ctf-scanner.h
@@ -49,7 +49,7 @@ struct ctf_ast *ctf_scanner_get_ast(struct ctf_scanner *scanner)
 	return scanner->ast;
 }
 
-__attribute__((visibility("hidden")))
+BT_HIDDEN
 int is_type(struct ctf_scanner *scanner, const char *id);
 
 #endif /* _CTF_SCANNER_H */
diff --git a/include/babeltrace/babeltrace-internal.h b/include/babeltrace/babeltrace-internal.h
index c567d39..6b6fcec 100644
--- a/include/babeltrace/babeltrace-internal.h
+++ b/include/babeltrace/babeltrace-internal.h
@@ -45,6 +45,11 @@ extern int babeltrace_verbose, babeltrace_debug;
 #define likely(x)	__builtin_expect(!!(x), 1)
 #define unlikely(x)	__builtin_expect(!!(x), 0)
 
+/*
+ * BT_HIDDEN: set the hidden attribute for internal functions
+ */
+#define BT_HIDDEN __attribute__((visibility("hidden")))
+
 struct trace_descriptor;
 struct trace_collection {
 	GPtrArray *array;	/* struct trace_descriptor */
-- 
1.7.10.4




             reply	other threads:[~2013-01-24 21:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 21:21 Julien Desfossez [this message]
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 02/18] Hide internal functions of ctf-text Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf Julien Desfossez
2013-01-24 21:26   ` Julien Desfossez
2013-01-24 22:08   ` Julien Desfossez
2013-01-24 22:27     ` Mathieu Desnoyers
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 04/18] namespace the scope_path functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 05/18] namespace the array functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 06/18] namespace declaration_ref and declaration_unref Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 07/18] namespace definition_ref and definition_unref Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 08/18] namespace the enum functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 09/18] namespace the int functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 10/18] namespace the sequence functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 11/18] namespace the string functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 12/18] namespace the struct functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 13/18] namespace the heap functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 14/18] namespace the collection functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 15/18] namespace the declaration functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 16/18] namespace the variant functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 17/18] namespace the definition functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 18/18] namespace the lookup_integer function Julien Desfossez

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=1359062510-7557-1-git-send-email-jdesfossez@efficios.com \
    --to=jdesfossez@efficios.com \
    /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