3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-08 10:25:18 +00:00

Hide non-exported symbols when compiling with gcc/clang.

I get a 17% reduction in the size of libz3.so on linux 32 bits, plus a 0.5-1% speedup when using the API.

Signed-off-by: Nuno Lopes <a-nlopes@microsoft.com>
This commit is contained in:
Nuno Lopes 2015-02-22 11:38:46 +00:00
parent 5676fbbc9e
commit 1e30fd2c65
7 changed files with 15 additions and 11 deletions

View file

@ -1782,7 +1782,7 @@ def mk_config():
FOCI2 = False
if GIT_HASH:
CPPFLAGS = '%s -DZ3GITHASH=%s' % (CPPFLAGS, GIT_HASH)
CXXFLAGS = '%s -c' % CXXFLAGS
CXXFLAGS = '%s -fvisibility=hidden -c' % CXXFLAGS
HAS_OMP = test_openmp(CXX)
if HAS_OMP:
CXXFLAGS = '%s -fopenmp -mfpmath=sse' % CXXFLAGS

View file

@ -300,7 +300,7 @@ extern "C" {
Z3_CATCH_RETURN(-1);
}
char const * Z3_API Z3_get_symbol_string(Z3_context c, Z3_symbol s) {
Z3_API char const * Z3_get_symbol_string(Z3_context c, Z3_symbol s) {
Z3_TRY;
LOG_Z3_get_symbol_string(c, s);
RESET_ERROR_CODE();
@ -823,7 +823,7 @@ extern "C" {
Z3_CATCH_RETURN(0);
}
char const * Z3_API Z3_ast_to_string(Z3_context c, Z3_ast a) {
Z3_API char const * Z3_ast_to_string(Z3_context c, Z3_ast a) {
Z3_TRY;
LOG_Z3_ast_to_string(c, a);
RESET_ERROR_CODE();
@ -866,11 +866,11 @@ extern "C" {
Z3_CATCH_RETURN(0);
}
char const * Z3_API Z3_sort_to_string(Z3_context c, Z3_sort s) {
Z3_API char const * Z3_sort_to_string(Z3_context c, Z3_sort s) {
return Z3_ast_to_string(c, reinterpret_cast<Z3_ast>(s));
}
char const * Z3_API Z3_func_decl_to_string(Z3_context c, Z3_func_decl f) {
Z3_API char const * Z3_func_decl_to_string(Z3_context c, Z3_func_decl f) {
return Z3_ast_to_string(c, reinterpret_cast<Z3_ast>(f));
}

View file

@ -548,12 +548,12 @@ extern "C" {
}
}
char const * Z3_API Z3_get_error_msg(Z3_error_code err) {
Z3_API char const * Z3_get_error_msg(Z3_error_code err) {
LOG_Z3_get_error_msg(err);
return _get_error_msg_ex(0, err);
}
char const * Z3_API Z3_get_error_msg_ex(Z3_context c, Z3_error_code err) {
Z3_API char const * Z3_get_error_msg_ex(Z3_context c, Z3_error_code err) {
LOG_Z3_get_error_msg_ex(c, err);
return _get_error_msg_ex(c, err);
}
@ -577,7 +577,7 @@ extern "C" {
};
ast_manager & Z3_API Z3_get_manager(__in Z3_context c) {
Z3_API ast_manager& Z3_get_manager(__in Z3_context c) {
return mk_c(c)->m();
}

View file

@ -651,7 +651,7 @@ extern "C" {
Z3_CATCH_RETURN(Z3_FALSE);
}
char const * Z3_API Z3_model_to_string(Z3_context c, Z3_model m) {
Z3_API char const * Z3_model_to_string(Z3_context c, Z3_model m) {
Z3_TRY;
LOG_Z3_model_to_string(c, m);
RESET_ERROR_CODE();

View file

@ -507,7 +507,7 @@ extern "C" {
return (Z3_ast)(p);
}
char const * Z3_API Z3_pattern_to_string(Z3_context c, Z3_pattern p) {
Z3_API char const * Z3_pattern_to_string(Z3_context c, Z3_pattern p) {
return Z3_ast_to_string(c, reinterpret_cast<Z3_ast>(p));
}

View file

@ -297,7 +297,7 @@ extern "C" {
Z3_CATCH;
}
char const * Z3_API Z3_context_to_string(Z3_context c) {
Z3_API char const * Z3_context_to_string(Z3_context c) {
Z3_TRY;
LOG_Z3_context_to_string(c);
RESET_ERROR_CODE();

View file

@ -21,6 +21,10 @@ Notes:
#ifndef _Z3__H_
#define _Z3__H_
#ifdef __GNUC__
# define Z3_API __attribute__ ((visibility ("default")))
#endif
#include<stdio.h>
#include"z3_macros.h"
#include"z3_api.h"