From: Mathieu Desnoyers Date: Fri, 10 Aug 2012 21:12:21 +0000 (-0400) Subject: Fix: protect visibility of ctf-parser functions X-Git-Tag: v1.0.0-rc5~31 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=fa45f52394a80b99ce747d1aed78653cb0a11e36 Fix: protect visibility of ctf-parser functions Some functions share the same name between ctf-parser/lexer and filter-parser/lexer. This patch protects the visibility of the functions with the same name to avoid linkage confusions. Signed-off-by: Mathieu Desnoyers Signed-off-by: Julien Desfossez --- diff --git a/formats/ctf/metadata/ctf-lexer.l b/formats/ctf/metadata/ctf-lexer.l index a0232aa4..5e99f7fc 100644 --- a/formats/ctf/metadata/ctf-lexer.l +++ b/formats/ctf/metadata/ctf-lexer.l @@ -23,7 +23,7 @@ #include "ctf-parser.h" #include "ctf-ast.h" -extern +__attribute__((visibility("protected"))) 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 58517e92..3ae0bc23 100644 --- a/formats/ctf/metadata/ctf-parser.y +++ b/formats/ctf/metadata/ctf-parser.y @@ -31,6 +31,7 @@ #include "ctf-parser.h" #include "ctf-ast.h" +__attribute__((visibility("protected"))) int yydebug; /* Join two lists, put "add" at the end of "head". */ @@ -46,10 +47,15 @@ _bt_list_splice_tail (struct bt_list_head *add, struct bt_list_head *head) } } +__attribute__((visibility("protected"))) int yyparse(struct ctf_scanner *scanner); +__attribute__((visibility("protected"))) int yylex(union YYSTYPE *yyval, struct ctf_scanner *scanner); +__attribute__((visibility("protected"))) int yylex_init_extra(struct ctf_scanner *scanner, yyscan_t * ptr_yy_globals); +__attribute__((visibility("protected"))) int yylex_destroy(yyscan_t yyscanner); +__attribute__((visibility("protected"))) void yyrestart(FILE * in_str, yyscan_t scanner); struct gc_string { @@ -86,6 +92,7 @@ static const char *node_type_to_str[] = { [ NODE_STRUCT ] = "NODE_STRUCT", }; +__attribute__((visibility("protected"))) const char *node_type(struct ctf_node *node) { if (node->type < NR_NODE_TYPES) @@ -116,6 +123,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("protected"))) struct gc_string *gc_string_append(struct ctf_scanner *scanner, struct gc_string *gstr, struct gc_string *gsrc) @@ -194,6 +202,7 @@ static int lookup_type(struct ctf_scanner_scope *s, const char *id) return ret; } +__attribute__((visibility("protected"))) int is_type(struct ctf_scanner *scanner, const char *id) { struct ctf_scanner_scope *it; @@ -773,11 +782,13 @@ static int set_parent_node(struct ctf_node *node, return 0; } +__attribute__((visibility("protected"))) void yyerror(struct ctf_scanner *scanner, const char *str) { fprintf(stderr, "error %s\n", str); } +__attribute__((visibility("protected"))) int yywrap(void) { return 1; diff --git a/formats/ctf/metadata/ctf-scanner.h b/formats/ctf/metadata/ctf-scanner.h index c6b70907..3bf2c690 100644 --- a/formats/ctf/metadata/ctf-scanner.h +++ b/formats/ctf/metadata/ctf-scanner.h @@ -49,6 +49,7 @@ struct ctf_ast *ctf_scanner_get_ast(struct ctf_scanner *scanner) return scanner->ast; } +__attribute__((visibility("protected"))) int is_type(struct ctf_scanner *scanner, const char *id); #endif /* _CTF_SCANNER_H */