You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/04/03 22:51:05 UTC
[lucy-commits] [1/9] git commit: refs/heads/chaz-cflags - Add chaz_CFlags_add_define
Updated Branches:
refs/heads/chaz-cflags 45abb0cff -> aa74b0aa0
Add chaz_CFlags_add_define
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/8e24b88e
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/8e24b88e
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/8e24b88e
Branch: refs/heads/chaz-cflags
Commit: 8e24b88e12f1c5e69abf62c9e0006b54a5c9f485
Parents: 45abb0c
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Apr 3 18:44:28 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Apr 3 18:44:28 2013 +0200
----------------------------------------------------------------------
charmonizer/src/Charmonizer/Core/CFlags.c | 22 ++++++++++++++++++++++
charmonizer/src/Charmonizer/Core/CFlags.h | 4 ++++
common/charmonizer.main | 22 +++++++++-------------
3 files changed, 35 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/8e24b88e/charmonizer/src/Charmonizer/Core/CFlags.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/CFlags.c b/charmonizer/src/Charmonizer/Core/CFlags.c
index 6978a43..180427e 100644
--- a/charmonizer/src/Charmonizer/Core/CFlags.c
+++ b/charmonizer/src/Charmonizer/Core/CFlags.c
@@ -98,6 +98,28 @@ chaz_CFlags_set_output_exe(chaz_CFlags *flags, const char *filename) {
}
void
+chaz_CFlags_add_define(chaz_CFlags *flags, const char *name,
+ const char *value) {
+ const char *define;
+ char *string;
+ if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
+ define = "/D";
+ }
+ else {
+ /* POSIX */
+ define = "-D ";
+ }
+ if (value) {
+ string = chaz_Util_join("", define, name, "=", value, NULL);
+ }
+ else {
+ string = chaz_Util_join("", define, name, NULL);
+ }
+ chaz_CFlags_append(flags, string);
+ free(string);
+}
+
+void
chaz_CFlags_add_include_dir(chaz_CFlags *flags, const char *dir) {
const char *include;
char *string;
http://git-wip-us.apache.org/repos/asf/lucy/blob/8e24b88e/charmonizer/src/Charmonizer/Core/CFlags.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/CFlags.h b/charmonizer/src/Charmonizer/Core/CFlags.h
index 4749460..4e712ed 100644
--- a/charmonizer/src/Charmonizer/Core/CFlags.h
+++ b/charmonizer/src/Charmonizer/Core/CFlags.h
@@ -52,6 +52,10 @@ void
chaz_CFlags_set_output_exe(chaz_CFlags *flags, const char *filename);
void
+chaz_CFlags_add_define(chaz_CFlags *flags, const char *name,
+ const char *value);
+
+void
chaz_CFlags_add_include_dir(chaz_CFlags *flags, const char *dir);
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/8e24b88e/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 2cc653c..eb93309 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -62,16 +62,6 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
/* Only core source files require this -- not our headers and
* autogenerated files. */
chaz_CFlags_append(extra_cflags, "-std=gnu99 -D_GNU_SOURCE");
-
- /* When compiling for Perl bindings, define HAS_BOOL so that the Perl
- * headers don't redefine 'bool' in conflict with C++.
- *
- * TODO: Compile all files that #include Perl headers separately and
- * remove this directive.
- */
- if (args->charmony_pm) {
- chaz_CFlags_append(extra_cflags, "-DHAS_BOOL");
- }
}
else if (chaz_Probe_msvc_version_num()) {
/* Compile as C++ under MSVC. */
@@ -85,10 +75,16 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
/* Redefine 'for' to fix broken 'for' scoping under MSVC6. */
chaz_CFlags_append(extra_cflags, "/Dfor=\"if(0);else for\"");
}
+ }
- if (args->charmony_pm) {
- chaz_CFlags_append(extra_cflags, "/DHAS_BOOL");
- }
+ /* When compiling for Perl bindings, define HAS_BOOL so that the Perl
+ * headers don't redefine 'bool' in conflict with C++.
+ *
+ * TODO: Compile all files that #include Perl headers separately and
+ * remove this directive.
+ */
+ if (args->charmony_pm) {
+ chaz_CFlags_add_define(extra_cflags, "HAS_BOOL", NULL);
}
}
[lucy-commits] [2/9] git commit: refs/heads/chaz-cflags - Regenerate charmonizer.c
Posted by nw...@apache.org.
Regenerate charmonizer.c
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/4a231ed4
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/4a231ed4
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/4a231ed4
Branch: refs/heads/chaz-cflags
Commit: 4a231ed49724e646791e3996a58ea9d9730de3b9
Parents: 8e24b88
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Apr 3 18:50:00 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Apr 3 18:50:00 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/common/charmonizer.c | 26 ++++++++++++++
clownfish/runtime/common/charmonizer.c | 26 ++++++++++++++
common/charmonizer.c | 48 +++++++++++++++++++-------
3 files changed, 87 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/4a231ed4/clownfish/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.c b/clownfish/compiler/common/charmonizer.c
index 627552f..d7c412e 100644
--- a/clownfish/compiler/common/charmonizer.c
+++ b/clownfish/compiler/common/charmonizer.c
@@ -71,6 +71,10 @@ void
chaz_CFlags_set_output_exe(chaz_CFlags *flags, const char *filename);
void
+chaz_CFlags_add_define(chaz_CFlags *flags, const char *name,
+ const char *value);
+
+void
chaz_CFlags_add_include_dir(chaz_CFlags *flags, const char *dir);
void
@@ -1170,6 +1174,28 @@ chaz_CFlags_set_output_exe(chaz_CFlags *flags, const char *filename) {
}
void
+chaz_CFlags_add_define(chaz_CFlags *flags, const char *name,
+ const char *value) {
+ const char *define;
+ char *string;
+ if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
+ define = "/D";
+ }
+ else {
+ /* POSIX */
+ define = "-D ";
+ }
+ if (value) {
+ string = chaz_Util_join("", define, name, "=", value, NULL);
+ }
+ else {
+ string = chaz_Util_join("", define, name, NULL);
+ }
+ chaz_CFlags_append(flags, string);
+ free(string);
+}
+
+void
chaz_CFlags_add_include_dir(chaz_CFlags *flags, const char *dir) {
const char *include;
char *string;
http://git-wip-us.apache.org/repos/asf/lucy/blob/4a231ed4/clownfish/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/common/charmonizer.c b/clownfish/runtime/common/charmonizer.c
index a0dd426..6cf33ce 100644
--- a/clownfish/runtime/common/charmonizer.c
+++ b/clownfish/runtime/common/charmonizer.c
@@ -71,6 +71,10 @@ void
chaz_CFlags_set_output_exe(chaz_CFlags *flags, const char *filename);
void
+chaz_CFlags_add_define(chaz_CFlags *flags, const char *name,
+ const char *value);
+
+void
chaz_CFlags_add_include_dir(chaz_CFlags *flags, const char *dir);
void
@@ -1475,6 +1479,28 @@ chaz_CFlags_set_output_exe(chaz_CFlags *flags, const char *filename) {
}
void
+chaz_CFlags_add_define(chaz_CFlags *flags, const char *name,
+ const char *value) {
+ const char *define;
+ char *string;
+ if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
+ define = "/D";
+ }
+ else {
+ /* POSIX */
+ define = "-D ";
+ }
+ if (value) {
+ string = chaz_Util_join("", define, name, "=", value, NULL);
+ }
+ else {
+ string = chaz_Util_join("", define, name, NULL);
+ }
+ chaz_CFlags_append(flags, string);
+ free(string);
+}
+
+void
chaz_CFlags_add_include_dir(chaz_CFlags *flags, const char *dir) {
const char *include;
char *string;
http://git-wip-us.apache.org/repos/asf/lucy/blob/4a231ed4/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index 1eaf9cf..26905be 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -71,6 +71,10 @@ void
chaz_CFlags_set_output_exe(chaz_CFlags *flags, const char *filename);
void
+chaz_CFlags_add_define(chaz_CFlags *flags, const char *name,
+ const char *value);
+
+void
chaz_CFlags_add_include_dir(chaz_CFlags *flags, const char *dir);
void
@@ -1475,6 +1479,28 @@ chaz_CFlags_set_output_exe(chaz_CFlags *flags, const char *filename) {
}
void
+chaz_CFlags_add_define(chaz_CFlags *flags, const char *name,
+ const char *value) {
+ const char *define;
+ char *string;
+ if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
+ define = "/D";
+ }
+ else {
+ /* POSIX */
+ define = "-D ";
+ }
+ if (value) {
+ string = chaz_Util_join("", define, name, "=", value, NULL);
+ }
+ else {
+ string = chaz_Util_join("", define, name, NULL);
+ }
+ chaz_CFlags_append(flags, string);
+ free(string);
+}
+
+void
chaz_CFlags_add_include_dir(chaz_CFlags *flags, const char *dir) {
const char *include;
char *string;
@@ -6171,16 +6197,6 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
/* Only core source files require this -- not our headers and
* autogenerated files. */
chaz_CFlags_append(extra_cflags, "-std=gnu99 -D_GNU_SOURCE");
-
- /* When compiling for Perl bindings, define HAS_BOOL so that the Perl
- * headers don't redefine 'bool' in conflict with C++.
- *
- * TODO: Compile all files that #include Perl headers separately and
- * remove this directive.
- */
- if (args->charmony_pm) {
- chaz_CFlags_append(extra_cflags, "-DHAS_BOOL");
- }
}
else if (chaz_Probe_msvc_version_num()) {
/* Compile as C++ under MSVC. */
@@ -6194,10 +6210,16 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
/* Redefine 'for' to fix broken 'for' scoping under MSVC6. */
chaz_CFlags_append(extra_cflags, "/Dfor=\"if(0);else for\"");
}
+ }
- if (args->charmony_pm) {
- chaz_CFlags_append(extra_cflags, "/DHAS_BOOL");
- }
+ /* When compiling for Perl bindings, define HAS_BOOL so that the Perl
+ * headers don't redefine 'bool' in conflict with C++.
+ *
+ * TODO: Compile all files that #include Perl headers separately and
+ * remove this directive.
+ */
+ if (args->charmony_pm) {
+ chaz_CFlags_add_define(extra_cflags, "HAS_BOOL", NULL);
}
}
[lucy-commits] [5/9] git commit: refs/heads/chaz-cflags - Compile and link test
executable with custom flags
Posted by nw...@apache.org.
Compile and link test executable with custom flags
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/ed2c0560
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/ed2c0560
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/ed2c0560
Branch: refs/heads/chaz-cflags
Commit: ed2c05608f50edc99c8d7ecaaf52a978149b5492
Parents: 89b7b93
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Apr 3 22:36:50 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Apr 3 22:36:50 2013 +0200
----------------------------------------------------------------------
charmonizer/src/Charmonizer/Core/Make.c | 28 +++++++++++-----------
charmonizer/src/Charmonizer/Core/Make.h | 12 +++++-----
common/charmonizer.main | 31 +++++++++++--------------
3 files changed, 34 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/ed2c0560/charmonizer/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.c b/charmonizer/src/Charmonizer/Core/Make.c
index 82fc379..c5baee9 100644
--- a/charmonizer/src/Charmonizer/Core/Make.c
+++ b/charmonizer/src/Charmonizer/Core/Make.c
@@ -241,24 +241,24 @@ chaz_MakeFile_add_dir_to_cleanup(chaz_MakeFile *makefile, const char *dir) {
chaz_MakeRule*
chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
- const char *objects, chaz_CFlags *library_flags) {
+ const char *sources, chaz_CFlags *link_flags) {
int cflags_style = chaz_CC_get_cflags_style();
chaz_CFlags *local_flags = chaz_CFlags_new(cflags_style);
const char *link = chaz_CC_link_command();
- const char *library_flags_string = "";
+ const char *link_flags_string = "";
const char *local_flags_string;
chaz_MakeRule *rule;
char *command;
- rule = chaz_MakeFile_add_rule(makefile, exe, objects);
+ rule = chaz_MakeFile_add_rule(makefile, exe, sources);
- if (library_flags) {
- library_flags_string = chaz_CFlags_get_string(library_flags);
+ if (link_flags) {
+ link_flags_string = chaz_CFlags_get_string(link_flags);
}
chaz_CFlags_set_link_output(local_flags, exe);
local_flags_string = chaz_CFlags_get_string(local_flags);
- command = chaz_Util_join(" ", link, local_flags_string, objects,
- library_flags_string, NULL);
+ command = chaz_Util_join(" ", link, sources, link_flags_string,
+ local_flags_string, NULL);
chaz_MakeRule_add_command(rule, command);
chaz_MakeFile_add_to_cleanup(makefile, exe);
@@ -270,25 +270,25 @@ chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
chaz_MakeRule*
chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *shared_lib,
- const char *objects, chaz_CFlags *library_flags) {
+ const char *sources, chaz_CFlags *link_flags) {
int cflags_style = chaz_CC_get_cflags_style();
chaz_CFlags *local_flags = chaz_CFlags_new(cflags_style);
const char *link = chaz_CC_link_command();
- const char *library_flags_string = "";
+ const char *link_flags_string = "";
const char *local_flags_string;
chaz_MakeRule *rule;
char *command;
- rule = chaz_MakeFile_add_rule(makefile, shared_lib, objects);
+ rule = chaz_MakeFile_add_rule(makefile, shared_lib, sources);
- if (library_flags) {
- library_flags_string = chaz_CFlags_get_string(library_flags);
+ if (link_flags) {
+ link_flags_string = chaz_CFlags_get_string(link_flags);
}
chaz_CFlags_link_shared_library(local_flags);
chaz_CFlags_set_link_output(local_flags, shared_lib);
local_flags_string = chaz_CFlags_get_string(local_flags);
- command = chaz_Util_join(" ", link, local_flags_string, objects,
- library_flags_string, NULL);
+ command = chaz_Util_join(" ", link, sources, link_flags_string,
+ local_flags_string, NULL);
chaz_MakeRule_add_command(rule, command);
chaz_MakeFile_add_to_cleanup(makefile, shared_lib);
http://git-wip-us.apache.org/repos/asf/lucy/blob/ed2c0560/charmonizer/src/Charmonizer/Core/Make.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.h b/charmonizer/src/Charmonizer/Core/Make.h
index 103133d..4307fd1 100644
--- a/charmonizer/src/Charmonizer/Core/Make.h
+++ b/charmonizer/src/Charmonizer/Core/Make.h
@@ -110,24 +110,24 @@ chaz_MakeFile_add_dir_to_cleanup(chaz_MakeFile *makefile, const char *dir);
*
* @param makefile The makefile.
* @param exe The name of the executable.
- * @param objects The list of object files.
- * @param library_flags Additional link flags for libraries.
+ * @param sources The list of source files.
+ * @param link_flags Additional link flags.
*/
chaz_MakeRule*
chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
- const char *objects, chaz_CFlags *library_flags);
+ const char *sources, chaz_CFlags *link_flags);
/** Add a rule to link a shared library. The shared library will also be added
* to the list of files to clean.
*
* @param makefile The makefile.
* @param shared_lib The name of the shared library.
- * @param objects The list of object files.
- * @param library_flags Additional link flags for libraries.
+ * @param sources The list of source files.
+ * @param link_flags Additional link flags.
*/
chaz_MakeRule*
chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *shared_lib,
- const char *objects, chaz_CFlags *library_flags);
+ const char *sources, chaz_CFlags *link_flags);
/** Write the makefile to a file named 'Makefile' in the current directory.
*
http://git-wip-us.apache.org/repos/asf/lucy/blob/ed2c0560/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index c007856..c3274b9 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -141,7 +141,7 @@ S_write_makefile() {
int cflags_style = chaz_CC_get_cflags_style();
chaz_CFlags *extra_cflags = chaz_CC_get_extra_cflags();
- chaz_CFlags *library_cflags;
+ chaz_CFlags *link_flags;
const char *math_library;
printf("Creating Makefile...\n");
@@ -253,9 +253,6 @@ S_write_makefile() {
chaz_MakeVar_append(var, "$(AUTOGEN_DIR)" DIR_SEP "source" DIR_SEP
"parcel$(OBJ_EXT)");
- chaz_MakeFile_add_var(makefile, "TEST_LUCY_OBJS",
- "t" DIR_SEP "test_lucy$(OBJ_EXT)");
-
/* Executables */
chaz_MakeFile_add_var(makefile, "LEMON_EXE",
@@ -298,26 +295,27 @@ S_write_makefile() {
chaz_MakeRule_add_prereq(rule, json_parser_c);
chaz_MakeRule_add_prereq(rule, "$(AUTOGEN_DIR)");
- library_cflags = chaz_CFlags_new(cflags_style);
+ link_flags = chaz_CFlags_new(cflags_style);
if (math_library) {
- chaz_CFlags_add_library(library_cflags, math_library);
+ chaz_CFlags_add_library(link_flags, math_library);
}
if (chaz_HeadCheck_check_header("pcre.h")) {
- chaz_CFlags_add_library(library_cflags, "pcre");
+ chaz_CFlags_add_library(link_flags, "pcre");
}
chaz_MakeFile_add_shared_lib(makefile, "$(LUCY_SHLIB)", "$(LUCY_OBJS)",
- library_cflags);
- chaz_CFlags_destroy(library_cflags);
-
- chaz_MakeFile_add_rule(makefile, "$(TEST_LUCY_OBJS)", "$(AUTOGEN_DIR)");
+ link_flags);
+ chaz_CFlags_destroy(link_flags);
- library_cflags = chaz_CFlags_new(cflags_style);
- chaz_CFlags_add_library_path(library_cflags, ".");
- chaz_CFlags_add_library(library_cflags, "lucy");
+ link_flags = chaz_CFlags_new(cflags_style);
+ chaz_CFlags_add_include_dir(link_flags, ".");
+ chaz_CFlags_add_include_dir(link_flags,
+ "$(AUTOGEN_DIR)" DIR_SEP "include");
+ chaz_CFlags_add_library_path(link_flags, ".");
+ chaz_CFlags_add_library(link_flags, "lucy");
rule = chaz_MakeFile_add_exe(makefile, "$(TEST_LUCY_EXE)",
- "$(TEST_LUCY_OBJS)", library_cflags);
+ "t" DIR_SEP "test_lucy.c", link_flags);
chaz_MakeRule_add_prereq(rule, "$(LUCY_SHLIB)");
- chaz_CFlags_destroy(library_cflags);
+ chaz_CFlags_destroy(link_flags);
rule = chaz_MakeFile_add_rule(makefile, "test", "$(TEST_LUCY_EXE)");
const char *test_command = "$(TEST_LUCY_EXE)";
@@ -326,7 +324,6 @@ S_write_makefile() {
}
chaz_MakeRule_add_command(rule, test_command);
- chaz_MakeFile_add_to_cleanup(makefile, "$(TEST_LUCY_OBJS)");
chaz_MakeFile_add_to_cleanup(makefile, "$(LUCY_OBJS)");
chaz_MakeFile_add_to_cleanup(makefile, json_parser_h);
chaz_MakeFile_add_to_cleanup(makefile, json_parser_c);
[lucy-commits] [8/9] git commit: refs/heads/chaz-cflags - Compile C library with
hidden symbols
Posted by nw...@apache.org.
Compile C library with hidden symbols
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/e0577808
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/e0577808
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/e0577808
Branch: refs/heads/chaz-cflags
Commit: e0577808a73d1bf204df148bca8a302c610e9888
Parents: 01ecac1
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Apr 3 22:46:51 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Apr 3 22:46:51 2013 +0200
----------------------------------------------------------------------
charmonizer/src/Charmonizer/Core/CFlags.c | 8 ++++++++
charmonizer/src/Charmonizer/Core/CFlags.h | 3 +++
common/charmonizer.main | 1 +
3 files changed, 12 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/e0577808/charmonizer/src/Charmonizer/Core/CFlags.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/CFlags.c b/charmonizer/src/Charmonizer/Core/CFlags.c
index 180427e..3e2a2cc 100644
--- a/charmonizer/src/Charmonizer/Core/CFlags.c
+++ b/charmonizer/src/Charmonizer/Core/CFlags.c
@@ -195,6 +195,14 @@ chaz_CFlags_compile_shared_library(chaz_CFlags *flags) {
}
void
+chaz_CFlags_hide_symbols(chaz_CFlags *flags) {
+ if (flags->style == CHAZ_CFLAGS_STYLE_GNU
+ && strcmp(chaz_OS_shared_lib_ext(), ".dll") != 0) {
+ chaz_CFlags_append(flags, "-fvisibility=hidden");
+ }
+}
+
+void
chaz_CFlags_link_shared_library(chaz_CFlags *flags) {
const char *string;
if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/e0577808/charmonizer/src/Charmonizer/Core/CFlags.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/CFlags.h b/charmonizer/src/Charmonizer/Core/CFlags.h
index 4e712ed..2b4ffe6 100644
--- a/charmonizer/src/Charmonizer/Core/CFlags.h
+++ b/charmonizer/src/Charmonizer/Core/CFlags.h
@@ -71,6 +71,9 @@ void
chaz_CFlags_compile_shared_library(chaz_CFlags *flags);
void
+chaz_CFlags_hide_symbols(chaz_CFlags *flags);
+
+void
chaz_CFlags_link_shared_library(chaz_CFlags *flags);
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/e0577808/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index c3274b9..4e41d74 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -190,6 +190,7 @@ S_write_makefile() {
chaz_CFlags_enable_optimization(extra_cflags);
chaz_CFlags_disable_strict_aliasing(extra_cflags);
chaz_CFlags_compile_shared_library(extra_cflags);
+ chaz_CFlags_hide_symbols(extra_cflags);
/* TODO: This makes extra_cflags and subsequent probes unusable. Find a
* better way to get flags for include dirs.
[lucy-commits] [7/9] git commit: refs/heads/chaz-cflags - Make lucy_bootstrap_parcel
visible
Posted by nw...@apache.org.
Make lucy_bootstrap_parcel visible
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/01ecac12
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/01ecac12
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/01ecac12
Branch: refs/heads/chaz-cflags
Commit: 01ecac1288ac0caf81bc8140eb186fd24e0f68b6
Parents: ddf4042
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Apr 3 22:45:43 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Apr 3 22:45:43 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCBindCore.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/01ecac12/clownfish/compiler/src/CFCBindCore.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindCore.c b/clownfish/compiler/src/CFCBindCore.c
index 2512750..3d3cc74 100644
--- a/clownfish/compiler/src/CFCBindCore.c
+++ b/clownfish/compiler/src/CFCBindCore.c
@@ -241,7 +241,7 @@ S_write_parcel_h(CFCBindCore *self) {
" #define VTableSpec cfish_VTableSpec\n"
"#endif\n"
"\n"
- "void\n"
+ "%sVISIBLE void\n"
"%sbootstrap_parcel();\n"
"\n"
"void\n"
@@ -257,7 +257,7 @@ S_write_parcel_h(CFCBindCore *self) {
"\n";
char *file_content
= CFCUtil_sprintf(pattern, self->header, aliases, typedefs, PREFIX,
- prefix, prefix, self->footer);
+ PREFIX, prefix, prefix, self->footer);
// Unlink then write file.
const char *inc_dest = CFCHierarchy_get_include_dest(hierarchy);
[lucy-commits] [6/9] git commit: refs/heads/chaz-cflags - Regenerate charmonizer.c
Posted by nw...@apache.org.
Regenerate charmonizer.c
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/ddf40422
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/ddf40422
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/ddf40422
Branch: refs/heads/chaz-cflags
Commit: ddf40422181cbb500e8cc5e4e78cd065ced8a22e
Parents: ed2c056
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Apr 3 22:37:39 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Apr 3 22:37:39 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/common/charmonizer.c | 40 +++++++-------
clownfish/runtime/common/charmonizer.c | 40 +++++++-------
common/charmonizer.c | 71 ++++++++++++-------------
3 files changed, 74 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/ddf40422/clownfish/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.c b/clownfish/compiler/common/charmonizer.c
index d7c412e..5beadea 100644
--- a/clownfish/compiler/common/charmonizer.c
+++ b/clownfish/compiler/common/charmonizer.c
@@ -494,24 +494,24 @@ chaz_MakeFile_add_dir_to_cleanup(chaz_MakeFile *makefile, const char *dir);
*
* @param makefile The makefile.
* @param exe The name of the executable.
- * @param objects The list of object files.
- * @param library_flags Additional link flags for libraries.
+ * @param sources The list of source files.
+ * @param link_flags Additional link flags.
*/
chaz_MakeRule*
chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
- const char *objects, chaz_CFlags *library_flags);
+ const char *sources, chaz_CFlags *link_flags);
/** Add a rule to link a shared library. The shared library will also be added
* to the list of files to clean.
*
* @param makefile The makefile.
* @param shared_lib The name of the shared library.
- * @param objects The list of object files.
- * @param library_flags Additional link flags for libraries.
+ * @param sources The list of source files.
+ * @param link_flags Additional link flags.
*/
chaz_MakeRule*
chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *shared_lib,
- const char *objects, chaz_CFlags *library_flags);
+ const char *sources, chaz_CFlags *link_flags);
/** Write the makefile to a file named 'Makefile' in the current directory.
*
@@ -3023,24 +3023,24 @@ chaz_MakeFile_add_dir_to_cleanup(chaz_MakeFile *makefile, const char *dir) {
chaz_MakeRule*
chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
- const char *objects, chaz_CFlags *library_flags) {
+ const char *sources, chaz_CFlags *link_flags) {
int cflags_style = chaz_CC_get_cflags_style();
chaz_CFlags *local_flags = chaz_CFlags_new(cflags_style);
const char *link = chaz_CC_link_command();
- const char *library_flags_string = "";
+ const char *link_flags_string = "";
const char *local_flags_string;
chaz_MakeRule *rule;
char *command;
- rule = chaz_MakeFile_add_rule(makefile, exe, objects);
+ rule = chaz_MakeFile_add_rule(makefile, exe, sources);
- if (library_flags) {
- library_flags_string = chaz_CFlags_get_string(library_flags);
+ if (link_flags) {
+ link_flags_string = chaz_CFlags_get_string(link_flags);
}
chaz_CFlags_set_link_output(local_flags, exe);
local_flags_string = chaz_CFlags_get_string(local_flags);
- command = chaz_Util_join(" ", link, local_flags_string, objects,
- library_flags_string, NULL);
+ command = chaz_Util_join(" ", link, sources, link_flags_string,
+ local_flags_string, NULL);
chaz_MakeRule_add_command(rule, command);
chaz_MakeFile_add_to_cleanup(makefile, exe);
@@ -3052,25 +3052,25 @@ chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
chaz_MakeRule*
chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *shared_lib,
- const char *objects, chaz_CFlags *library_flags) {
+ const char *sources, chaz_CFlags *link_flags) {
int cflags_style = chaz_CC_get_cflags_style();
chaz_CFlags *local_flags = chaz_CFlags_new(cflags_style);
const char *link = chaz_CC_link_command();
- const char *library_flags_string = "";
+ const char *link_flags_string = "";
const char *local_flags_string;
chaz_MakeRule *rule;
char *command;
- rule = chaz_MakeFile_add_rule(makefile, shared_lib, objects);
+ rule = chaz_MakeFile_add_rule(makefile, shared_lib, sources);
- if (library_flags) {
- library_flags_string = chaz_CFlags_get_string(library_flags);
+ if (link_flags) {
+ link_flags_string = chaz_CFlags_get_string(link_flags);
}
chaz_CFlags_link_shared_library(local_flags);
chaz_CFlags_set_link_output(local_flags, shared_lib);
local_flags_string = chaz_CFlags_get_string(local_flags);
- command = chaz_Util_join(" ", link, local_flags_string, objects,
- library_flags_string, NULL);
+ command = chaz_Util_join(" ", link, sources, link_flags_string,
+ local_flags_string, NULL);
chaz_MakeRule_add_command(rule, command);
chaz_MakeFile_add_to_cleanup(makefile, shared_lib);
http://git-wip-us.apache.org/repos/asf/lucy/blob/ddf40422/clownfish/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/common/charmonizer.c b/clownfish/runtime/common/charmonizer.c
index 6cf33ce..891475b 100644
--- a/clownfish/runtime/common/charmonizer.c
+++ b/clownfish/runtime/common/charmonizer.c
@@ -494,24 +494,24 @@ chaz_MakeFile_add_dir_to_cleanup(chaz_MakeFile *makefile, const char *dir);
*
* @param makefile The makefile.
* @param exe The name of the executable.
- * @param objects The list of object files.
- * @param library_flags Additional link flags for libraries.
+ * @param sources The list of source files.
+ * @param link_flags Additional link flags.
*/
chaz_MakeRule*
chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
- const char *objects, chaz_CFlags *library_flags);
+ const char *sources, chaz_CFlags *link_flags);
/** Add a rule to link a shared library. The shared library will also be added
* to the list of files to clean.
*
* @param makefile The makefile.
* @param shared_lib The name of the shared library.
- * @param objects The list of object files.
- * @param library_flags Additional link flags for libraries.
+ * @param sources The list of source files.
+ * @param link_flags Additional link flags.
*/
chaz_MakeRule*
chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *shared_lib,
- const char *objects, chaz_CFlags *library_flags);
+ const char *sources, chaz_CFlags *link_flags);
/** Write the makefile to a file named 'Makefile' in the current directory.
*
@@ -3328,24 +3328,24 @@ chaz_MakeFile_add_dir_to_cleanup(chaz_MakeFile *makefile, const char *dir) {
chaz_MakeRule*
chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
- const char *objects, chaz_CFlags *library_flags) {
+ const char *sources, chaz_CFlags *link_flags) {
int cflags_style = chaz_CC_get_cflags_style();
chaz_CFlags *local_flags = chaz_CFlags_new(cflags_style);
const char *link = chaz_CC_link_command();
- const char *library_flags_string = "";
+ const char *link_flags_string = "";
const char *local_flags_string;
chaz_MakeRule *rule;
char *command;
- rule = chaz_MakeFile_add_rule(makefile, exe, objects);
+ rule = chaz_MakeFile_add_rule(makefile, exe, sources);
- if (library_flags) {
- library_flags_string = chaz_CFlags_get_string(library_flags);
+ if (link_flags) {
+ link_flags_string = chaz_CFlags_get_string(link_flags);
}
chaz_CFlags_set_link_output(local_flags, exe);
local_flags_string = chaz_CFlags_get_string(local_flags);
- command = chaz_Util_join(" ", link, local_flags_string, objects,
- library_flags_string, NULL);
+ command = chaz_Util_join(" ", link, sources, link_flags_string,
+ local_flags_string, NULL);
chaz_MakeRule_add_command(rule, command);
chaz_MakeFile_add_to_cleanup(makefile, exe);
@@ -3357,25 +3357,25 @@ chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
chaz_MakeRule*
chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *shared_lib,
- const char *objects, chaz_CFlags *library_flags) {
+ const char *sources, chaz_CFlags *link_flags) {
int cflags_style = chaz_CC_get_cflags_style();
chaz_CFlags *local_flags = chaz_CFlags_new(cflags_style);
const char *link = chaz_CC_link_command();
- const char *library_flags_string = "";
+ const char *link_flags_string = "";
const char *local_flags_string;
chaz_MakeRule *rule;
char *command;
- rule = chaz_MakeFile_add_rule(makefile, shared_lib, objects);
+ rule = chaz_MakeFile_add_rule(makefile, shared_lib, sources);
- if (library_flags) {
- library_flags_string = chaz_CFlags_get_string(library_flags);
+ if (link_flags) {
+ link_flags_string = chaz_CFlags_get_string(link_flags);
}
chaz_CFlags_link_shared_library(local_flags);
chaz_CFlags_set_link_output(local_flags, shared_lib);
local_flags_string = chaz_CFlags_get_string(local_flags);
- command = chaz_Util_join(" ", link, local_flags_string, objects,
- library_flags_string, NULL);
+ command = chaz_Util_join(" ", link, sources, link_flags_string,
+ local_flags_string, NULL);
chaz_MakeRule_add_command(rule, command);
chaz_MakeFile_add_to_cleanup(makefile, shared_lib);
http://git-wip-us.apache.org/repos/asf/lucy/blob/ddf40422/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index d9ff1ff..7cb93a3 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -494,24 +494,24 @@ chaz_MakeFile_add_dir_to_cleanup(chaz_MakeFile *makefile, const char *dir);
*
* @param makefile The makefile.
* @param exe The name of the executable.
- * @param objects The list of object files.
- * @param library_flags Additional link flags for libraries.
+ * @param sources The list of source files.
+ * @param link_flags Additional link flags.
*/
chaz_MakeRule*
chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
- const char *objects, chaz_CFlags *library_flags);
+ const char *sources, chaz_CFlags *link_flags);
/** Add a rule to link a shared library. The shared library will also be added
* to the list of files to clean.
*
* @param makefile The makefile.
* @param shared_lib The name of the shared library.
- * @param objects The list of object files.
- * @param library_flags Additional link flags for libraries.
+ * @param sources The list of source files.
+ * @param link_flags Additional link flags.
*/
chaz_MakeRule*
chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *shared_lib,
- const char *objects, chaz_CFlags *library_flags);
+ const char *sources, chaz_CFlags *link_flags);
/** Write the makefile to a file named 'Makefile' in the current directory.
*
@@ -3328,24 +3328,24 @@ chaz_MakeFile_add_dir_to_cleanup(chaz_MakeFile *makefile, const char *dir) {
chaz_MakeRule*
chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
- const char *objects, chaz_CFlags *library_flags) {
+ const char *sources, chaz_CFlags *link_flags) {
int cflags_style = chaz_CC_get_cflags_style();
chaz_CFlags *local_flags = chaz_CFlags_new(cflags_style);
const char *link = chaz_CC_link_command();
- const char *library_flags_string = "";
+ const char *link_flags_string = "";
const char *local_flags_string;
chaz_MakeRule *rule;
char *command;
- rule = chaz_MakeFile_add_rule(makefile, exe, objects);
+ rule = chaz_MakeFile_add_rule(makefile, exe, sources);
- if (library_flags) {
- library_flags_string = chaz_CFlags_get_string(library_flags);
+ if (link_flags) {
+ link_flags_string = chaz_CFlags_get_string(link_flags);
}
chaz_CFlags_set_link_output(local_flags, exe);
local_flags_string = chaz_CFlags_get_string(local_flags);
- command = chaz_Util_join(" ", link, local_flags_string, objects,
- library_flags_string, NULL);
+ command = chaz_Util_join(" ", link, sources, link_flags_string,
+ local_flags_string, NULL);
chaz_MakeRule_add_command(rule, command);
chaz_MakeFile_add_to_cleanup(makefile, exe);
@@ -3357,25 +3357,25 @@ chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
chaz_MakeRule*
chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *shared_lib,
- const char *objects, chaz_CFlags *library_flags) {
+ const char *sources, chaz_CFlags *link_flags) {
int cflags_style = chaz_CC_get_cflags_style();
chaz_CFlags *local_flags = chaz_CFlags_new(cflags_style);
const char *link = chaz_CC_link_command();
- const char *library_flags_string = "";
+ const char *link_flags_string = "";
const char *local_flags_string;
chaz_MakeRule *rule;
char *command;
- rule = chaz_MakeFile_add_rule(makefile, shared_lib, objects);
+ rule = chaz_MakeFile_add_rule(makefile, shared_lib, sources);
- if (library_flags) {
- library_flags_string = chaz_CFlags_get_string(library_flags);
+ if (link_flags) {
+ link_flags_string = chaz_CFlags_get_string(link_flags);
}
chaz_CFlags_link_shared_library(local_flags);
chaz_CFlags_set_link_output(local_flags, shared_lib);
local_flags_string = chaz_CFlags_get_string(local_flags);
- command = chaz_Util_join(" ", link, local_flags_string, objects,
- library_flags_string, NULL);
+ command = chaz_Util_join(" ", link, sources, link_flags_string,
+ local_flags_string, NULL);
chaz_MakeRule_add_command(rule, command);
chaz_MakeFile_add_to_cleanup(makefile, shared_lib);
@@ -6276,7 +6276,7 @@ S_write_makefile() {
int cflags_style = chaz_CC_get_cflags_style();
chaz_CFlags *extra_cflags = chaz_CC_get_extra_cflags();
- chaz_CFlags *library_cflags;
+ chaz_CFlags *link_flags;
const char *math_library;
printf("Creating Makefile...\n");
@@ -6388,9 +6388,6 @@ S_write_makefile() {
chaz_MakeVar_append(var, "$(AUTOGEN_DIR)" DIR_SEP "source" DIR_SEP
"parcel$(OBJ_EXT)");
- chaz_MakeFile_add_var(makefile, "TEST_LUCY_OBJS",
- "t" DIR_SEP "test_lucy$(OBJ_EXT)");
-
/* Executables */
chaz_MakeFile_add_var(makefile, "LEMON_EXE",
@@ -6433,26 +6430,27 @@ S_write_makefile() {
chaz_MakeRule_add_prereq(rule, json_parser_c);
chaz_MakeRule_add_prereq(rule, "$(AUTOGEN_DIR)");
- library_cflags = chaz_CFlags_new(cflags_style);
+ link_flags = chaz_CFlags_new(cflags_style);
if (math_library) {
- chaz_CFlags_add_library(library_cflags, math_library);
+ chaz_CFlags_add_library(link_flags, math_library);
}
if (chaz_HeadCheck_check_header("pcre.h")) {
- chaz_CFlags_add_library(library_cflags, "pcre");
+ chaz_CFlags_add_library(link_flags, "pcre");
}
chaz_MakeFile_add_shared_lib(makefile, "$(LUCY_SHLIB)", "$(LUCY_OBJS)",
- library_cflags);
- chaz_CFlags_destroy(library_cflags);
-
- chaz_MakeFile_add_rule(makefile, "$(TEST_LUCY_OBJS)", "$(AUTOGEN_DIR)");
+ link_flags);
+ chaz_CFlags_destroy(link_flags);
- library_cflags = chaz_CFlags_new(cflags_style);
- chaz_CFlags_add_library_path(library_cflags, ".");
- chaz_CFlags_add_library(library_cflags, "lucy");
+ link_flags = chaz_CFlags_new(cflags_style);
+ chaz_CFlags_add_include_dir(link_flags, ".");
+ chaz_CFlags_add_include_dir(link_flags,
+ "$(AUTOGEN_DIR)" DIR_SEP "include");
+ chaz_CFlags_add_library_path(link_flags, ".");
+ chaz_CFlags_add_library(link_flags, "lucy");
rule = chaz_MakeFile_add_exe(makefile, "$(TEST_LUCY_EXE)",
- "$(TEST_LUCY_OBJS)", library_cflags);
+ "t" DIR_SEP "test_lucy.c", link_flags);
chaz_MakeRule_add_prereq(rule, "$(LUCY_SHLIB)");
- chaz_CFlags_destroy(library_cflags);
+ chaz_CFlags_destroy(link_flags);
rule = chaz_MakeFile_add_rule(makefile, "test", "$(TEST_LUCY_EXE)");
const char *test_command = "$(TEST_LUCY_EXE)";
@@ -6461,7 +6459,6 @@ S_write_makefile() {
}
chaz_MakeRule_add_command(rule, test_command);
- chaz_MakeFile_add_to_cleanup(makefile, "$(TEST_LUCY_OBJS)");
chaz_MakeFile_add_to_cleanup(makefile, "$(LUCY_OBJS)");
chaz_MakeFile_add_to_cleanup(makefile, json_parser_h);
chaz_MakeFile_add_to_cleanup(makefile, json_parser_c);
[lucy-commits] [4/9] git commit: refs/heads/chaz-cflags - Regenerate charmonizer.c
Posted by nw...@apache.org.
Regenerate charmonizer.c
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/89b7b93b
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/89b7b93b
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/89b7b93b
Branch: refs/heads/chaz-cflags
Commit: 89b7b93bd686e598727346844219f2b4939c691b
Parents: f908dc0
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Apr 3 19:53:23 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Apr 3 19:53:23 2013 +0200
----------------------------------------------------------------------
common/charmonizer.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/89b7b93b/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index 26905be..d9ff1ff 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -6221,6 +6221,8 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
if (args->charmony_pm) {
chaz_CFlags_add_define(extra_cflags, "HAS_BOOL", NULL);
}
+
+ chaz_CFlags_add_define(extra_cflags, "CFP_LUCY", NULL);
}
static void
[lucy-commits] [9/9] git commit: refs/heads/chaz-cflags - Regenerate charmonizer.c
Posted by nw...@apache.org.
Regenerate charmonizer.c
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/aa74b0aa
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/aa74b0aa
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/aa74b0aa
Branch: refs/heads/chaz-cflags
Commit: aa74b0aa07a770d76d06ffc8b9c83da38a3f7bca
Parents: e057780
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Apr 3 22:47:13 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Apr 3 22:47:13 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/common/charmonizer.c | 11 +++++++++++
clownfish/runtime/common/charmonizer.c | 11 +++++++++++
common/charmonizer.c | 12 ++++++++++++
3 files changed, 34 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/aa74b0aa/clownfish/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.c b/clownfish/compiler/common/charmonizer.c
index 5beadea..b2e6b66 100644
--- a/clownfish/compiler/common/charmonizer.c
+++ b/clownfish/compiler/common/charmonizer.c
@@ -90,6 +90,9 @@ void
chaz_CFlags_compile_shared_library(chaz_CFlags *flags);
void
+chaz_CFlags_hide_symbols(chaz_CFlags *flags);
+
+void
chaz_CFlags_link_shared_library(chaz_CFlags *flags);
void
@@ -1271,6 +1274,14 @@ chaz_CFlags_compile_shared_library(chaz_CFlags *flags) {
}
void
+chaz_CFlags_hide_symbols(chaz_CFlags *flags) {
+ if (flags->style == CHAZ_CFLAGS_STYLE_GNU
+ && strcmp(chaz_OS_shared_lib_ext(), ".dll") != 0) {
+ chaz_CFlags_append(flags, "-fvisibility=hidden");
+ }
+}
+
+void
chaz_CFlags_link_shared_library(chaz_CFlags *flags) {
const char *string;
if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/aa74b0aa/clownfish/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/common/charmonizer.c b/clownfish/runtime/common/charmonizer.c
index 891475b..fa50687 100644
--- a/clownfish/runtime/common/charmonizer.c
+++ b/clownfish/runtime/common/charmonizer.c
@@ -90,6 +90,9 @@ void
chaz_CFlags_compile_shared_library(chaz_CFlags *flags);
void
+chaz_CFlags_hide_symbols(chaz_CFlags *flags);
+
+void
chaz_CFlags_link_shared_library(chaz_CFlags *flags);
void
@@ -1576,6 +1579,14 @@ chaz_CFlags_compile_shared_library(chaz_CFlags *flags) {
}
void
+chaz_CFlags_hide_symbols(chaz_CFlags *flags) {
+ if (flags->style == CHAZ_CFLAGS_STYLE_GNU
+ && strcmp(chaz_OS_shared_lib_ext(), ".dll") != 0) {
+ chaz_CFlags_append(flags, "-fvisibility=hidden");
+ }
+}
+
+void
chaz_CFlags_link_shared_library(chaz_CFlags *flags) {
const char *string;
if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/aa74b0aa/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index 7cb93a3..67b6182 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -90,6 +90,9 @@ void
chaz_CFlags_compile_shared_library(chaz_CFlags *flags);
void
+chaz_CFlags_hide_symbols(chaz_CFlags *flags);
+
+void
chaz_CFlags_link_shared_library(chaz_CFlags *flags);
void
@@ -1576,6 +1579,14 @@ chaz_CFlags_compile_shared_library(chaz_CFlags *flags) {
}
void
+chaz_CFlags_hide_symbols(chaz_CFlags *flags) {
+ if (flags->style == CHAZ_CFLAGS_STYLE_GNU
+ && strcmp(chaz_OS_shared_lib_ext(), ".dll") != 0) {
+ chaz_CFlags_append(flags, "-fvisibility=hidden");
+ }
+}
+
+void
chaz_CFlags_link_shared_library(chaz_CFlags *flags) {
const char *string;
if (flags->style == CHAZ_CFLAGS_STYLE_MSVC) {
@@ -6325,6 +6336,7 @@ S_write_makefile() {
chaz_CFlags_enable_optimization(extra_cflags);
chaz_CFlags_disable_strict_aliasing(extra_cflags);
chaz_CFlags_compile_shared_library(extra_cflags);
+ chaz_CFlags_hide_symbols(extra_cflags);
/* TODO: This makes extra_cflags and subsequent probes unusable. Find a
* better way to get flags for include dirs.
[lucy-commits] [3/9] git commit: refs/heads/chaz-cflags - Use per-parcel defines for
symbol visibility
Posted by nw...@apache.org.
Use per-parcel defines for symbol visibility
Use macro LUCY_VISIBLE for externally visible symbols. This macro will
be set to CHY_EXPORT when compiling with -DCFP_LUCY and to CHY_IMPORT
otherwise.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f908dc0c
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f908dc0c
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f908dc0c
Branch: refs/heads/chaz-cflags
Commit: f908dc0c51e051d7f0283b5ae62262cb84244394
Parents: 4a231ed
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Apr 3 19:47:53 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Apr 3 19:47:53 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/src/CFCBindClass.c | 18 +++++++-----------
clownfish/compiler/src/CFCBindCore.c | 14 +++++++++-----
clownfish/compiler/src/CFCBindMethod.c | 8 +++-----
common/charmonizer.main | 2 ++
perl/xs/XSBind.h | 20 +++++++++-----------
5 files changed, 30 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/f908dc0c/clownfish/compiler/src/CFCBindClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindClass.c b/clownfish/compiler/src/CFCBindClass.c
index cfa6a65..ca93610 100644
--- a/clownfish/compiler/src/CFCBindClass.c
+++ b/clownfish/compiler/src/CFCBindClass.c
@@ -155,6 +155,7 @@ static char*
S_to_c_header_dynamic(CFCBindClass *self) {
const char *privacy_symbol = CFCClass_privacy_symbol(self->client);
const char *vt_var = CFCClass_full_vtable_var(self->client);
+ const char *PREFIX = CFCClass_get_PREFIX(self->client);
char *struct_def = S_struct_definition(self);
char *parent_include = S_parent_include(self);
char *sub_declarations = S_sub_declarations(self);
@@ -163,9 +164,6 @@ S_to_c_header_dynamic(CFCBindClass *self) {
char *method_defs = S_method_defs(self);
char *short_names = S_short_names(self);
- const char *visibility = CFCClass_included(self->client)
- ? "CHY_IMPORT" : "CHY_EXPORT";
-
char pattern[] =
"#include \"charmony.h\"\n"
"#include \"parcel.h\"\n"
@@ -207,7 +205,7 @@ S_to_c_header_dynamic(CFCBindClass *self) {
"/* Declare the VTable singleton for this class.\n"
" */\n"
"\n"
- "extern %s cfish_VTable *%s;\n"
+ "extern %sVISIBLE cfish_VTable *%s;\n"
"\n"
"/* Define \"short names\" for this class's symbols.\n"
" */\n"
@@ -218,7 +216,7 @@ S_to_c_header_dynamic(CFCBindClass *self) {
= CFCUtil_sprintf(pattern, parent_include, privacy_symbol,
struct_def, privacy_symbol, inert_var_defs,
sub_declarations, method_typedefs, method_defs,
- visibility, vt_var, short_names);
+ PREFIX, vt_var, short_names);
FREEMEM(struct_def);
FREEMEM(parent_include);
@@ -453,8 +451,7 @@ S_parent_include(CFCBindClass *self) {
// Add a C function definition for each method and each function.
static char*
S_sub_declarations(CFCBindClass *self) {
- const char *visibility = CFCClass_included(self->client)
- ? "CHY_IMPORT " : "CHY_EXPORT ";
+ const char *PREFIX = CFCClass_get_PREFIX(self->client);
CFCFunction **functions = CFCClass_functions(self->client);
CFCMethod** fresh_methods = CFCClass_fresh_methods(self->client);
char *declarations = CFCUtil_strdup("");
@@ -462,7 +459,7 @@ S_sub_declarations(CFCBindClass *self) {
CFCFunction *func = functions[i];
char *dec = CFCBindFunc_func_declaration(func);
if (!CFCFunction_inline(func)) {
- declarations = CFCUtil_cat(declarations, visibility, NULL);
+ declarations = CFCUtil_cat(declarations, PREFIX, "VISIBLE ", NULL);
}
declarations = CFCUtil_cat(declarations, dec, "\n\n", NULL);
FREEMEM(dec);
@@ -480,13 +477,12 @@ S_sub_declarations(CFCBindClass *self) {
// Declare class (a.k.a. "inert") variables.
static char*
S_inert_var_declarations(CFCBindClass *self) {
- const char *visibility = CFCClass_included(self->client)
- ? "CHY_IMPORT " : "CHY_EXPORT ";
+ const char *PREFIX = CFCClass_get_PREFIX(self->client);
CFCVariable **inert_vars = CFCClass_inert_vars(self->client);
char *declarations = CFCUtil_strdup("");
for (int i = 0; inert_vars[i] != NULL; i++) {
const char *global_c = CFCVariable_global_c(inert_vars[i]);
- declarations = CFCUtil_cat(declarations, "extern ", visibility,
+ declarations = CFCUtil_cat(declarations, "extern ", PREFIX, "VISIBLE ",
global_c, ";\n", NULL);
}
return declarations;
http://git-wip-us.apache.org/repos/asf/lucy/blob/f908dc0c/clownfish/compiler/src/CFCBindCore.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindCore.c b/clownfish/compiler/src/CFCBindCore.c
index 7cf461e..2512750 100644
--- a/clownfish/compiler/src/CFCBindCore.c
+++ b/clownfish/compiler/src/CFCBindCore.c
@@ -141,14 +141,12 @@ S_write_parcel_h(CFCBindCore *self) {
CFCUtil_die("No source classes found.");
}
const char *prefix = CFCParcel_get_prefix(parcel);
+ const char *PREFIX = CFCParcel_get_PREFIX(parcel);
FREEMEM(ordered);
// Create Clownfish aliases if necessary.
char *aliases = CFCBindAliases_c_aliases();
- const char *visibility = strcmp(prefix, "lucy_") == 0
- ? "CHY_EXPORT" : "CHY_IMPORT";
-
const char pattern[] =
"%s\n"
"#ifndef CFCPARCEL_H\n"
@@ -161,6 +159,12 @@ S_write_parcel_h(CFCBindCore *self) {
"#include <stddef.h>\n"
"#include \"charmony.h\"\n"
"\n"
+ "#ifdef CFP_LUCY\n"
+ " #define LUCY_VISIBLE CHY_EXPORT\n"
+ "#else\n"
+ " #define LUCY_VISIBLE CHY_IMPORT\n"
+ "#endif\n"
+ "\n"
"%s\n"
"%s\n"
"\n"
@@ -193,7 +197,7 @@ S_write_parcel_h(CFCBindCore *self) {
" ((_full_meth ## _t)cfish_super_method(_vtable, \\\n"
" _full_meth ## _OFFSET))\n"
"\n"
- "extern %s size_t cfish_VTable_offset_of_parent;\n"
+ "extern %sVISIBLE size_t cfish_VTable_offset_of_parent;\n"
"static CHY_INLINE cfish_method_t\n"
"cfish_super_method(const void *vtable, size_t offset) {\n"
" char *vt_as_char = (char*)vtable;\n"
@@ -252,7 +256,7 @@ S_write_parcel_h(CFCBindCore *self) {
"%s\n"
"\n";
char *file_content
- = CFCUtil_sprintf(pattern, self->header, aliases, typedefs, visibility,
+ = CFCUtil_sprintf(pattern, self->header, aliases, typedefs, PREFIX,
prefix, prefix, self->footer);
// Unlink then write file.
http://git-wip-us.apache.org/repos/asf/lucy/blob/f908dc0c/clownfish/compiler/src/CFCBindMethod.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindMethod.c b/clownfish/compiler/src/CFCBindMethod.c
index eec71f1..512fc1c 100644
--- a/clownfish/compiler/src/CFCBindMethod.c
+++ b/clownfish/compiler/src/CFCBindMethod.c
@@ -86,13 +86,11 @@ S_final_method_def(CFCMethod *method, CFCClass *klass) {
static char*
S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
CFCParamList *param_list = CFCMethod_get_param_list(method);
+ const char *PREFIX = CFCClass_get_PREFIX(klass);
const char *invoker_struct = CFCClass_full_struct_sym(klass);
const char *common_struct
= CFCType_get_specifier(CFCMethod_self_type(method));
- const char *visibility = CFCClass_included(klass)
- ? "CHY_IMPORT" : "CHY_EXPORT";
-
char *full_meth_sym = CFCMethod_full_method_sym(method, klass);
char *full_offset_sym = CFCMethod_full_offset_sym(method, klass);
char *full_typedef = CFCMethod_full_typedef(method, klass);
@@ -114,7 +112,7 @@ S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
const char *maybe_return = CFCType_is_void(return_type) ? "" : "return ";
const char pattern[] =
- "extern %s size_t %s;\n"
+ "extern %sVISIBLE size_t %s;\n"
"static CHY_INLINE %s\n"
"%s(const %s *self%s) {\n"
" char *const method_address = *(char**)self + %s;\n"
@@ -122,7 +120,7 @@ S_virtual_method_def(CFCMethod *method, CFCClass *klass) {
" %smethod((%s*)self%s);\n"
"}\n";
char *method_def
- = CFCUtil_sprintf(pattern, visibility, full_offset_sym, ret_type_str,
+ = CFCUtil_sprintf(pattern, PREFIX, full_offset_sym, ret_type_str,
full_meth_sym, invoker_struct, params_minus_invoker,
full_offset_sym, full_typedef, full_typedef,
maybe_return, common_struct,
http://git-wip-us.apache.org/repos/asf/lucy/blob/f908dc0c/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index eb93309..c007856 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -86,6 +86,8 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
if (args->charmony_pm) {
chaz_CFlags_add_define(extra_cflags, "HAS_BOOL", NULL);
}
+
+ chaz_CFlags_add_define(extra_cflags, "CFP_LUCY", NULL);
}
static void
http://git-wip-us.apache.org/repos/asf/lucy/blob/f908dc0c/perl/xs/XSBind.h
----------------------------------------------------------------------
diff --git a/perl/xs/XSBind.h b/perl/xs/XSBind.h
index 1c74a54..347f5c0 100644
--- a/perl/xs/XSBind.h
+++ b/perl/xs/XSBind.h
@@ -37,8 +37,6 @@
#define NEED_newRV_noinc_GLOBAL
#include "ppport.h"
-#define XSBIND_EXTERN CHY_EXPORT
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -46,7 +44,7 @@ extern "C" {
/** Given either a class name or a perl object, manufacture a new Clownfish
* object suitable for supplying to a cfish_Foo_init() function.
*/
-XSBIND_EXTERN cfish_Obj*
+LUCY_VISIBLE cfish_Obj*
cfish_XSBind_new_blank_obj(SV *either_sv);
/** Test whether an SV is defined. Handles "get" magic, unlike SvOK on its
@@ -66,13 +64,13 @@ cfish_XSBind_sv_defined(SV *sv) {
* <code>allocation</code>, assign the SV's string to it, and return that
* instead. If all else fails, throw an exception.
*/
-XSBIND_EXTERN cfish_Obj*
+LUCY_VISIBLE cfish_Obj*
cfish_XSBind_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable, void *allocation);
/** As XSBind_sv_to_cfish_obj above, but returns NULL instead of throwing an
* exception.
*/
-XSBIND_EXTERN cfish_Obj*
+LUCY_VISIBLE cfish_Obj*
cfish_XSBind_maybe_sv_to_cfish_obj(SV *sv, cfish_VTable *vtable,
void *allocation);
@@ -118,24 +116,24 @@ cfish_XSBind_cfish_obj_to_sv_noinc(cfish_Obj *obj) {
* SVs, ByteBufs to SVs, VArrays to Perl array refs, Hashes to Perl hashrefs,
* and any other object to a Perl object wrapping the Clownfish Obj.
*/
-XSBIND_EXTERN SV*
+LUCY_VISIBLE SV*
cfish_XSBind_cfish_to_perl(cfish_Obj *obj);
/** Deep conversion of Perl data structures to Clownfish objects -- Perl hash
* to Hash, Perl array to VArray, Clownfish objects stripped of their
* wrappers, and everything else stringified and turned to a CharBuf.
*/
-XSBIND_EXTERN cfish_Obj*
+LUCY_VISIBLE cfish_Obj*
cfish_XSBind_perl_to_cfish(SV *sv);
/** Convert a ByteBuf into a new string SV.
*/
-XSBIND_EXTERN SV*
+LUCY_VISIBLE SV*
cfish_XSBind_bb_to_sv(const cfish_ByteBuf *bb);
/** Convert a CharBuf into a new UTF-8 string SV.
*/
-XSBIND_EXTERN SV*
+LUCY_VISIBLE SV*
cfish_XSBind_cb_to_sv(const cfish_CharBuf *cb);
/** Perl-specific wrapper for Err#trap. The "routine" must be either a
@@ -146,7 +144,7 @@ cfish_XSBind_trap(SV *routine, SV *context);
/** Turn on overloading for the supplied Perl object and its class.
*/
-XSBIND_EXTERN void
+LUCY_VISIBLE void
cfish_XSBind_enable_overload(void *pobj);
/** Process hash-style params passed to an XS subroutine. The varargs must be
@@ -210,7 +208,7 @@ cfish_XSBind_enable_overload(void *pobj);
* (generally, the XS variable "items").
* @return true on success, false on failure (sets Err_error).
*/
-XSBIND_EXTERN bool
+LUCY_VISIBLE bool
cfish_XSBind_allot_params(SV** stack, int32_t start,
int32_t num_stack_elems, ...);