lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [11/14] git commit: refs/heads/master - Add accessors for cc, cflags.
Date Wed, 02 Jan 2013 20:38:07 GMT
Add accessors for cc, cflags.

Add some accessors for cc and cflags in addition to extra_cflags.
Normalize the spelling of "cflags" rather than "ccflags" or "cc_flags"
to represent the consensus that exists outside of the Perl community.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/d7046135
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/d7046135
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/d7046135

Branch: refs/heads/master
Commit: d70461357b6e47c1b888e9d9b148540849565fe1
Parents: e0e5399
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Tue Dec 11 16:40:08 2012 -0800
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Wed Jan 2 12:10:12 2013 -0800

----------------------------------------------------------------------
 charmonizer/src/Charmonizer/Core/Compiler.c |   24 +++++++++++++++------
 charmonizer/src/Charmonizer/Core/Compiler.h |   12 ++++++++++-
 charmonizer/src/Charmonizer/Probe.c         |   12 +++++-----
 charmonizer/src/Charmonizer/Probe.h         |    6 ++--
 4 files changed, 37 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/d7046135/charmonizer/src/Charmonizer/Core/Compiler.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Compiler.c b/charmonizer/src/Charmonizer/Core/Compiler.c
index a084893..f828224 100644
--- a/charmonizer/src/Charmonizer/Core/Compiler.c
+++ b/charmonizer/src/Charmonizer/Core/Compiler.c
@@ -34,7 +34,7 @@ chaz_CC_detect_known_compilers(void);
 /* Static vars. */
 static struct {
     char     *cc_command;
-    char     *cc_flags;
+    char     *cflags;
     char     *extra_cflags;
     char     *try_exe_name;
     char     *try_obj_name;
@@ -80,7 +80,7 @@ chaz_CC_init(const char *compiler_command, const char *compiler_flags) {
 
     /* Assign, init. */
     chaz_CC.cc_command      = chaz_Util_strdup(compiler_command);
-    chaz_CC.cc_flags        = chaz_Util_strdup(compiler_flags);
+    chaz_CC.cflags          = chaz_Util_strdup(compiler_flags);
     chaz_CC.extra_cflags    = chaz_Util_strdup("");
 
     /* Set names for the targets which we "try" to compile. */
@@ -168,7 +168,7 @@ chaz_CC_detect_known_compilers(void) {
 void
 chaz_CC_clean_up(void) {
     free(chaz_CC.cc_command);
-    free(chaz_CC.cc_flags);
+    free(chaz_CC.cflags);
     free(chaz_CC.extra_cflags);
     free(chaz_CC.try_obj_name);
     free(chaz_CC.try_exe_name);
@@ -188,7 +188,7 @@ chaz_CC_compile_exe(const char *source_path, const char *exe_name,
                                  + strlen(source_path)
                                  + strlen(chaz_CC.exe_flag)
                                  + exe_file_buf_len
-                                 + strlen(chaz_CC.cc_flags)
+                                 + strlen(chaz_CC.cflags)
                                  + strlen(chaz_CC.extra_cflags)
                                  + 200; /* command start, _charm_run, etc.  */
     char *command = (char*)malloc(command_max_size);
@@ -202,7 +202,7 @@ chaz_CC_compile_exe(const char *source_path, const char *exe_name,
             chaz_CC.cc_command, chaz_CC.error_flag, 
             source_path, chaz_CC.exe_flag, 
             exe_file,
-            chaz_CC.cc_flags, chaz_CC.extra_cflags);
+            chaz_CC.cflags, chaz_CC.extra_cflags);
     if (chaz_Util_verbosity < 2) {
         chaz_OS_run_quietly(command);
     }
@@ -245,7 +245,7 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
                                  + strlen(source_path)
                                  + strlen(chaz_CC.object_flag)
                                  + obj_file_buf_len
-                                 + strlen(chaz_CC.cc_flags)
+                                 + strlen(chaz_CC.cflags)
                                  + strlen(chaz_CC.extra_cflags)
                                  + 200; /* command start, _charm_run, etc.  */
     char *command = (char*)malloc(command_max_size);
@@ -259,7 +259,7 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
             chaz_CC.cc_command, chaz_CC.no_link_flag, chaz_CC.error_flag,
             source_path, chaz_CC.object_flag, 
             obj_file,
-            chaz_CC.cc_flags, chaz_CC.extra_cflags);
+            chaz_CC.cflags, chaz_CC.extra_cflags);
     if (chaz_Util_verbosity < 2) {
         chaz_OS_run_quietly(command);
     }
@@ -343,6 +343,16 @@ chaz_CC_add_extra_cflags(const char *flags) {
 }
 
 const char*
+chaz_CC_get_cc(void) {
+    return chaz_CC.cc_command;
+}
+
+const char*
+chaz_CC_get_cflags(void) {
+    return chaz_CC.cflags;
+}
+
+const char*
 chaz_CC_get_extra_cflags(void) {
     return chaz_CC.extra_cflags;
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/d7046135/charmonizer/src/Charmonizer/Core/Compiler.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Compiler.h b/charmonizer/src/Charmonizer/Core/Compiler.h
index 3e67c83..7f0fbda 100644
--- a/charmonizer/src/Charmonizer/Core/Compiler.h
+++ b/charmonizer/src/Charmonizer/Core/Compiler.h
@@ -58,7 +58,7 @@ chaz_CC_capture_output(const char *source, size_t *output_len);
 /** Initialize the compiler environment.
  */
 void
-chaz_CC_init(const char *cc_command, const char *cc_flags);
+chaz_CC_init(const char *cc_command, const char *cflags);
 
 /* Clean up the environment.
  */
@@ -74,6 +74,16 @@ chaz_CC_set_warnings_as_errors(const int flag);
 void
 chaz_CC_add_extra_cflags(const char *);
 
+/* Accessor for the compiler executable's string representation.
+ */
+const char*
+chaz_CC_get_cc(void);
+
+/* Accessor for `cflags`.
+ */
+const char*
+chaz_CC_get_cflags(void);
+
 /* Accessor for `extra_cflags`.
  */
 const char*

http://git-wip-us.apache.org/repos/asf/lucy/blob/d7046135/charmonizer/src/Charmonizer/Probe.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe.c b/charmonizer/src/Charmonizer/Probe.c
index 5e3364e..c9824f1 100644
--- a/charmonizer/src/Charmonizer/Probe.c
+++ b/charmonizer/src/Charmonizer/Probe.c
@@ -68,13 +68,13 @@ chaz_Probe_parse_cli_args(int argc, const char *argv[],
     /* Accumulate compiler flags. */
     for (; i < argc; i++) {
         const char *arg = argv[i];
-        size_t new_len = strlen(arg) + strlen(args->ccflags) + 2;
-        if (new_len >= CHAZ_PROBE_MAX_FLAGS_LEN) {
+        size_t new_len = strlen(arg) + strlen(args->cflags) + 2;
+        if (new_len >= CHAZ_PROBE_MAX_CFLAGS_LEN) {
             fprintf(stderr, "Exceeded max length for compiler flags");
             exit(1);
         }
-        strcat(args->ccflags, " ");
-        strcat(args->ccflags, arg);
+        strcat(args->cflags, " ");
+        strcat(args->cflags, arg);
     }
 
     /* Process CHARM_VERBOSITY environment variable. */
@@ -97,7 +97,7 @@ void
 chaz_Probe_die_usage(void) {
     fprintf(stderr,
             "Usage: ./charmonize --cc=CC_COMMAND [--enable-c] "
-            "[--enable-perl] [--enable-ruby] -- CC_FLAGS\n");
+            "[--enable-perl] [--enable-ruby] -- CFLAGS\n");
     exit(1);
 }
 
@@ -115,7 +115,7 @@ chaz_Probe_init(struct chaz_CLIArgs *args) {
 
     /* Dispatch other initializers. */
     chaz_OS_init();
-    chaz_CC_init(args->cc, args->ccflags);
+    chaz_CC_init(args->cc, args->cflags);
     chaz_ConfWriter_init();
     chaz_HeadCheck_init();
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/d7046135/charmonizer/src/Charmonizer/Probe.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Probe.h b/charmonizer/src/Charmonizer/Probe.h
index 53f4f5c..6adad50 100644
--- a/charmonizer/src/Charmonizer/Probe.h
+++ b/charmonizer/src/Charmonizer/Probe.h
@@ -25,11 +25,11 @@ extern "C" {
 #include <stdio.h>
 
 #define CHAZ_PROBE_MAX_CC_LEN 100
-#define CHAZ_PROBE_MAX_FLAGS_LEN 2000
+#define CHAZ_PROBE_MAX_CFLAGS_LEN 2000
 
 struct chaz_CLIArgs {
     char cc[CHAZ_PROBE_MAX_CC_LEN + 1];
-    char ccflags[CHAZ_PROBE_MAX_FLAGS_LEN + 1];
+    char cflags[CHAZ_PROBE_MAX_CFLAGS_LEN + 1];
     int  charmony_h;
     int  charmony_pm;
     int  charmony_rb;
@@ -43,7 +43,7 @@ struct chaz_CLIArgs {
  *              [--enable-c]
  *              [--enable-perl]
  *              [--enable-ruby]
- *              [-- [CC_FLAGS]]
+ *              [-- [CFLAGS]]
  *
  * @return true if argument parsing proceeds without incident, false if
  * unexpected arguments are encountered or values are missing or invalid.


Mime
View raw message