From 5e3df64a460116b1a4480c29cf4a141d41b3ccf4 Mon Sep 17 00:00:00 2001 From: Andrew Hlynskyi Date: Thu, 17 Aug 2023 15:01:47 +0300 Subject: [PATCH] fix(lib): expose only symbols defined in api.h --- Makefile | 2 +- lib/include/tree_sitter/api.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 57f19da3..f2afed00 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ endif OBJ := $(SRC:.c=.o) # define default flags, and override to append mandatory flags -override CFLAGS := -O3 -std=gnu99 -fPIC -Wall -Wextra -Werror -Wshadow $(CFLAGS) +override CFLAGS := -O3 -std=gnu99 -fPIC -fvisibility=hidden -Wall -Wextra -Werror -Wshadow $(CFLAGS) override CFLAGS += -Ilib/src -Ilib/include # ABI versioning diff --git a/lib/include/tree_sitter/api.h b/lib/include/tree_sitter/api.h index 9e936ff8..1cc6b3e9 100644 --- a/lib/include/tree_sitter/api.h +++ b/lib/include/tree_sitter/api.h @@ -1,6 +1,8 @@ #ifndef TREE_SITTER_API_H_ #define TREE_SITTER_API_H_ +#pragma GCC visibility push(default) + #ifdef __cplusplus extern "C" { #endif @@ -1163,4 +1165,6 @@ void ts_set_allocator( } #endif +#pragma GCC visibility pop + #endif // TREE_SITTER_API_H_