You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2012/06/14 02:37:48 UTC
[lucy-commits] svn commit: r1350065 - in /lucy/trunk/charmonizer/src/Charmonizer/Probe:
AtomicOps.c DirManip.c Floats.c FuncMacro.c Headers.c Integers.c
LargeFiles.c Memory.c SymbolVisibility.c UnusedVars.c VariadicMacros.c
Author: marvin
Date: Thu Jun 14 00:37:47 2012
New Revision: 1350065
URL: http://svn.apache.org/viewvc?rev=1350065&view=rev
Log:
Replace simple uses of ConfWriter_append_conf().
Cut over invocations of ConfWriter_append_conf() to new routines when
the replacement is straightforward.
Modified:
lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/Floats.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/Headers.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c
lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/AtomicOps.c Thu Jun 14 00:37:47 2012
@@ -47,25 +47,25 @@ AtomicOps_run(void) {
if (HeadCheck_check_header("libkern/OSAtomic.h")) {
has_libkern_osatomic_h = true;
- ConfWriter_append_conf("#define CHY_HAS_LIBKERN_OSATOMIC_H\n");
+ ConfWriter_add_def("HAS_LIBKERN_OSATOMIC_H", NULL);
/* Check for OSAtomicCompareAndSwapPtr, introduced in later versions
* of OSAtomic.h. */
has_osatomic_cas_ptr = CC_test_compile(osatomic_casptr_code,
strlen(osatomic_casptr_code));
if (has_osatomic_cas_ptr) {
- ConfWriter_append_conf("#define CHY_HAS_OSATOMIC_CAS_PTR\n");
+ ConfWriter_add_def("HAS_OSATOMIC_CAS_PTR", NULL);
}
}
if (HeadCheck_check_header("sys/atomic.h")) {
has_sys_atomic_h = true;
- ConfWriter_append_conf("#define CHY_HAS_SYS_ATOMIC_H\n");
+ ConfWriter_add_def("HAS_SYS_ATOMIC_H", NULL);
}
if (HeadCheck_check_header("windows.h")
&& HeadCheck_check_header("intrin.h")
) {
has_intrin_h = true;
- ConfWriter_append_conf("#define CHY_HAS_INTRIN_H\n");
+ ConfWriter_add_def("HAS_INTRIN_H", NULL);
}
/* Shorten */
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/DirManip.c Thu Jun 14 00:37:47 2012
@@ -140,10 +140,10 @@ DirManip_run(void) {
/* Header checks. */
if (has_dirent_h) {
- ConfWriter_append_conf("#define CHY_HAS_DIRENT_H\n");
+ ConfWriter_add_def("HAS_DIRENT_H", NULL);
}
if (has_direct_h) {
- ConfWriter_append_conf("#define CHY_HAS_DIRECT_H\n");
+ ConfWriter_add_def("HAS_DIRECT_H", NULL);
}
/* Check for members in struct dirent. */
@@ -153,14 +153,14 @@ DirManip_run(void) {
"#include <sys/types.h>\n#include <dirent.h>"
);
if (has_dirent_d_namlen) {
- ConfWriter_append_conf("#define CHY_HAS_DIRENT_D_NAMLEN\n", dir_sep);
+ ConfWriter_add_def("HAS_DIRENT_D_NAMLEN", NULL);
}
has_dirent_d_type = HeadCheck_contains_member(
"struct dirent", "d_type",
"#include <sys/types.h>\n#include <dirent.h>"
);
if (has_dirent_d_type) {
- ConfWriter_append_conf("#define CHY_HAS_DIRENT_D_TYPE\n", dir_sep);
+ ConfWriter_add_def("HAS_DIRENT_D_TYPE", NULL);
}
}
@@ -193,7 +193,7 @@ DirManip_run(void) {
OS_mkdir("_charm_test_remove_me");
if (0 == remove("_charm_test_remove_me")) {
remove_zaps_dirs = true;
- ConfWriter_append_conf("#define CHY_REMOVE_ZAPS_DIRS\n");
+ ConfWriter_add_def("REMOVE_ZAPS_DIRS", NULL);
}
OS_rmdir("_charm_test_remove_me");
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/Floats.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/Floats.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/Floats.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/Floats.c Thu Jun 14 00:37:47 2012
@@ -37,13 +37,13 @@ Floats_run(void) {
"static const chy_floatu64 chy_f64inf = {CHY_U64_C(0x7ff0000000000000)};\n"
"static const chy_floatu64 chy_f64neginf = {CHY_U64_C(0xfff0000000000000)};\n"
"static const chy_floatu64 chy_f64nan = {CHY_U64_C(0x7ff8000000000000)};\n"
- "#define CHY_F32_INF (chy_f32inf.f)\n"
- "#define CHY_F32_NEGINF (chy_f32neginf.f)\n"
- "#define CHY_F32_NAN (chy_f32nan.f)\n"
- "#define CHY_F64_INF (chy_f64inf.d)\n"
- "#define CHY_F64_NEGINF (chy_f64neginf.d)\n"
- "#define CHY_F64_NAN (chy_f64nan.d)\n"
);
+ ConfWriter_add_def("F32_INF", "(chy_f32inf.f)");
+ ConfWriter_add_def("F32_NEGINF", "(chy_f32neginf.f)");
+ ConfWriter_add_def("F32_NAN", "(chy_f32nan.f)");
+ ConfWriter_add_def("F64_INF", "(chy_f64inf.d)");
+ ConfWriter_add_def("F64_NEGINF", "(chy_f64neginf.d)");
+ ConfWriter_add_def("F64_NAN", "(chy_f64nan.d)");
/* Shorten. */
ConfWriter_start_short_names();
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/FuncMacro.c Thu Jun 14 00:37:47 2012
@@ -101,19 +101,16 @@ FuncMacro_run(void) {
const char *macro_text = has_iso_funcmac
? "__func__"
: "__FUNCTION__";
- ConfWriter_append_conf(
- "#define CHY_HAS_FUNC_MACRO\n"
- "#define CHY_FUNC_MACRO %s\n",
- macro_text
- );
+ ConfWriter_add_def("HAS_FUNC_MACRO", NULL);
+ ConfWriter_add_def("FUNC_MACRO", macro_text);
}
/* Write out specific defines. */
if (has_iso_funcmac) {
- ConfWriter_append_conf("#define CHY_HAS_ISO_FUNC_MACRO\n");
+ ConfWriter_add_def("HAS_ISO_FUNC_MACRO", NULL);
}
if (has_gnuc_funcmac) {
- ConfWriter_append_conf("#define CHY_HAS_GNUC_FUNC_MACRO\n");
+ ConfWriter_add_def("HAS_GNUC_FUNC_MACRO", NULL);
}
/* Check for inline keyword. */
@@ -123,13 +120,13 @@ FuncMacro_run(void) {
output = S_try_inline(inline_option, &output_len);
if (output != NULL) {
has_inline = true;
- ConfWriter_append_conf("#define CHY_INLINE %s\n", inline_option);
+ ConfWriter_add_def("INLINE", inline_option);
free(output);
break;
}
}
if (!has_inline) {
- ConfWriter_append_conf("#define CHY_INLINE\n");
+ ConfWriter_add_def("INLINE", NULL);
}
/* Shorten. */
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/Headers.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/Headers.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/Headers.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/Headers.c Thu Jun 14 00:37:47 2012
@@ -110,7 +110,7 @@ Headers_run(void) {
/* Try for all POSIX headers in one blast. */
if (HeadCheck_check_many_headers((const char**)posix_headers)) {
has_posix = true;
- ConfWriter_append_conf("#define CHY_HAS_POSIX\n");
+ ConfWriter_add_def("HAS_POSIX", NULL);
for (i = 0; posix_headers[i] != NULL; i++) {
S_keep(posix_headers[i]);
}
@@ -127,8 +127,8 @@ Headers_run(void) {
/* Test for all c89 headers in one blast. */
if (HeadCheck_check_many_headers((const char**)c89_headers)) {
has_c89 = true;
- ConfWriter_append_conf("#define CHY_HAS_C89\n");
- ConfWriter_append_conf("#define CHY_HAS_C90\n");
+ ConfWriter_add_def("HAS_C89", NULL);
+ ConfWriter_add_def("HAS_C90", NULL);
for (i = 0; c89_headers[i] != NULL; i++) {
S_keep(c89_headers[i]);
}
@@ -165,7 +165,7 @@ Headers_run(void) {
/* Append the config with every header detected so far. */
for (i = 0; keepers[i] != NULL; i++) {
S_encode_affirmation(keepers[i]);
- ConfWriter_append_conf("#define CHY_%s\n", aff_buf);
+ ConfWriter_add_def(aff_buf, NULL);
}
/* Shorten. */
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c Thu Jun 14 00:37:47 2012
@@ -88,15 +88,16 @@ Integers_run(void) {
char i64_t_postfix[10];
char u64_t_postfix[10];
char code_buf[1000];
+ char scratch[50];
ConfWriter_start_module("Integers");
/* Document endian-ness. */
if (S_machine_is_big_endian()) {
- ConfWriter_append_conf("#define CHY_BIG_END\n");
+ ConfWriter_add_def("BIG_END", NULL);
}
else {
- ConfWriter_append_conf("#define CHY_LITTLE_END\n");
+ ConfWriter_add_def("LITTLE_END", NULL);
}
/* Record sizeof() for several common integer types. */
@@ -204,37 +205,42 @@ Integers_run(void) {
/* Write out some conditional defines. */
if (has_inttypes) {
- ConfWriter_append_conf("#define CHY_HAS_INTTYPES_H\n");
+ ConfWriter_add_def("HAS_INTTYPES_H", NULL);
}
if (has_stdint) {
- ConfWriter_append_conf("#define CHY_HAS_STDINT_H\n");
+ ConfWriter_add_def("HAS_STDINT_H", NULL);
}
if (has_long_long) {
- ConfWriter_append_conf("#define CHY_HAS_LONG_LONG\n");
+ ConfWriter_add_def("HAS_LONG_LONG", NULL);
}
if (has___int64) {
- ConfWriter_append_conf("#define CHY_HAS___INT64\n");
+ ConfWriter_add_def("HAS___INT64", NULL);
}
/* Write out sizes. */
- ConfWriter_append_conf("#define CHY_SIZEOF_CHAR %d\n", sizeof_char);
- ConfWriter_append_conf("#define CHY_SIZEOF_SHORT %d\n", sizeof_short);
- ConfWriter_append_conf("#define CHY_SIZEOF_INT %d\n", sizeof_int);
- ConfWriter_append_conf("#define CHY_SIZEOF_LONG %d\n", sizeof_long);
- ConfWriter_append_conf("#define CHY_SIZEOF_PTR %d\n", sizeof_ptr);
+ sprintf(scratch, "%d", sizeof_char);
+ ConfWriter_add_def("SIZEOF_CHAR", scratch);
+ sprintf(scratch, "%d", sizeof_short);
+ ConfWriter_add_def("SIZEOF_SHORT", scratch);
+ sprintf(scratch, "%d", sizeof_int);
+ ConfWriter_add_def("SIZEOF_INT", scratch);
+ sprintf(scratch, "%d", sizeof_long);
+ ConfWriter_add_def("SIZEOF_LONG", scratch);
+ sprintf(scratch, "%d", sizeof_ptr);
+ ConfWriter_add_def("SIZEOF_PTR", scratch);
if (has_long_long) {
- ConfWriter_append_conf("#define CHY_SIZEOF_LONG_LONG %d\n",
- sizeof_long_long);
+ sprintf(scratch, "%d", sizeof_long_long);
+ ConfWriter_add_def("SIZEOF_LONG_LONG", scratch);
}
if (has___int64) {
- ConfWriter_append_conf("#define CHY_SIZEOF___INT64 %d\n",
- sizeof___int64);
+ sprintf(scratch, "%d", sizeof___int64);
+ ConfWriter_add_def("SIZEOF___INT64", scratch);
}
/* Write affirmations, typedefs and maximums/minimums. */
- ConfWriter_append_conf("typedef int chy_bool_t;\n");
+ ConfWriter_add_typedef("int", "bool_t");
if (has_stdint) {
- ConfWriter_append_conf("#include <stdint.h>\n");
+ ConfWriter_add_sys_include("stdint.h");
}
else {
/* we support only the following subset of stdint.h
@@ -248,76 +254,68 @@ Integers_run(void) {
* uint64_t
*/
if (has_8) {
- ConfWriter_append_conf(
- "typedef signed char int8_t;\n"
- "typedef unsigned char uint8_t;\n"
- );
+ ConfWriter_add_typedef("signed char", "int8_t");
+ ConfWriter_add_typedef("unsigned char", "uint8_t");
}
if (has_16) {
- ConfWriter_append_conf(
- "typedef short int16_t;\n"
- "typedef unsigned short uint16_t;\n"
- );
+ ConfWriter_add_typedef("signed short", "int16_t");
+ ConfWriter_add_typedef("unsigned short", "uint16_t");
}
if (has_32) {
- ConfWriter_append_conf(
- "typedef %s int32_t;\n", i32_t_type
- );
- ConfWriter_append_conf(
- "typedef unsigned %s uint32_t;\n", i32_t_type
- );
+ ConfWriter_add_typedef(i32_t_type, "int32_t");
+ sprintf(scratch, "unsigned %s", i32_t_type);
+ ConfWriter_add_typedef(scratch, "uint32_t");
}
if (has_64) {
- ConfWriter_append_conf(
- "typedef %s int64_t;\n", i64_t_type
- );
- ConfWriter_append_conf(
- "typedef unsigned %s uint64_t;\n", i64_t_type
- );
+ ConfWriter_add_typedef(i64_t_type, "int64_t");
+ sprintf(scratch, "unsigned %s", i64_t_type);
+ ConfWriter_add_typedef(scratch, "uint64_t");
}
}
if (has_8) {
- ConfWriter_append_conf(
- "#define CHY_HAS_I8_T\n"
- "typedef signed char chy_i8_t;\n"
- "typedef unsigned char chy_u8_t;\n"
- "#define CHY_I8_MAX 0x7F\n"
- "#define CHY_I8_MIN (-I8_MAX - 1)\n"
- "#define CHY_U8_MAX (I8_MAX * 2 + 1)\n"
- );
+ ConfWriter_add_def("HAS_I8_T", NULL);
+ ConfWriter_add_typedef("signed char", "i8_t");
+ ConfWriter_add_typedef("unsigned char", "u8_t");
+ /* FIXME: use integer literals. */
+ ConfWriter_add_def("I8_MAX", "0x7F");
+ ConfWriter_add_def("I8_MIN", "(-I8_MAX - 1)");
+ ConfWriter_add_def("U8_MAX", "(I8_MAX * 2 + 1)");
}
if (has_16) {
- ConfWriter_append_conf(
- "#define CHY_HAS_I16_T\n"
- "typedef short chy_i16_t;\n"
- "typedef unsigned short chy_u16_t;\n"
- "#define CHY_I16_MAX 0x7FFF\n"
- "#define CHY_I16_MIN (-I16_MAX - 1)\n"
- "#define CHY_U16_MAX (I16_MAX * 2 + 1)\n"
- );
+ ConfWriter_add_def("HAS_I16_T", NULL);
+ ConfWriter_add_typedef("short", "i16_t");
+ ConfWriter_add_typedef("unsigned short", "u16_t");
+ /* FIXME: use integer literals. */
+ ConfWriter_add_def("I16_MAX", "0x7FFF");
+ ConfWriter_add_def("I16_MIN", "(-I16_MAX - 1)");
+ ConfWriter_add_def("U16_MAX", "(I16_MAX * 2 + 1)");
}
if (has_32) {
- ConfWriter_append_conf("#define CHY_HAS_I32_T\n");
- ConfWriter_append_conf("typedef %s chy_i32_t;\n", i32_t_type);
- ConfWriter_append_conf("typedef unsigned %s chy_u32_t;\n",
- i32_t_type);
- ConfWriter_append_conf("#define CHY_I32_MAX 0x7FFFFFFF%s\n",
- i32_t_postfix);
- ConfWriter_append_conf("#define CHY_I32_MIN (-I32_MAX - 1)\n");
- ConfWriter_append_conf("#define CHY_U32_MAX (I32_MAX * 2%s + 1%s)\n",
- u32_t_postfix, u32_t_postfix);
+ ConfWriter_add_def("HAS_I32_T", NULL);
+ ConfWriter_add_typedef(i32_t_type, "i32_t");
+ sprintf(scratch, "unsigned %s", i32_t_type);
+ ConfWriter_add_typedef(scratch, "u32_t");
+ /* FIXME: use integer literals. */
+ sprintf(scratch, "0x7FFFFFFF%s", i32_t_postfix);
+ ConfWriter_add_def("I32_MAX", scratch);
+ ConfWriter_add_def("I32_MIN", "(-I32_MAX - 1)");
+ sprintf(scratch, "(I32_MAX * 2%s + 1%s)", u32_t_postfix,
+ u32_t_postfix);
+ ConfWriter_add_def("U32_MAX", scratch);
}
if (has_64) {
- ConfWriter_append_conf("#define CHY_HAS_I64_T\n");
- ConfWriter_append_conf("typedef %s chy_i64_t;\n", i64_t_type);
- ConfWriter_append_conf("typedef unsigned %s chy_u64_t;\n",
- i64_t_type);
- ConfWriter_append_conf("#define CHY_I64_MAX 0x7FFFFFFFFFFFFFFF%s\n",
- i64_t_postfix);
- ConfWriter_append_conf("#define CHY_I64_MIN (-I64_MAX - 1%s)\n",
- i64_t_postfix);
- ConfWriter_append_conf("#define CHY_U64_MAX (I64_MAX * 2%s + 1%s)\n",
- u64_t_postfix, u64_t_postfix);
+ ConfWriter_add_def("HAS_I64_T", NULL);
+ ConfWriter_add_typedef(i64_t_type, "i64_t");
+ sprintf(scratch, "unsigned %s", i64_t_type);
+ ConfWriter_add_typedef(scratch, "u64_t");
+ /* FIXME: use integer literals. */
+ sprintf(scratch, "0x7FFFFFFFFFFFFFFF%s", i64_t_postfix);
+ ConfWriter_add_def("I64_MAX", scratch);
+ sprintf(scratch, "(-I64_MAX - 1%s)", i64_t_postfix);
+ ConfWriter_add_def("I64_MIN", scratch);
+ sprintf(scratch, "(I64_MAX * 2%s + 1%s)", u64_t_postfix,
+ u64_t_postfix);
+ ConfWriter_add_def("U64_MAX", scratch);
}
/* Create the I64P and U64P printf macros. */
@@ -350,10 +348,10 @@ Integers_run(void) {
if (output_len != 0
&& strcmp(output, "18446744073709551615") == 0
) {
- ConfWriter_append_conf("#define CHY_I64P \"%sd\"\n",
- options[i]);
- ConfWriter_append_conf("#define CHY_U64P \"%su\"\n",
- options[i]);
+ sprintf(scratch, "\"%sd\"", options[i]);
+ ConfWriter_add_def("I64P", scratch);
+ sprintf(scratch, "\"%su\"", options[i]);
+ ConfWriter_add_def("U64P", scratch);
break;
}
}
@@ -363,31 +361,33 @@ Integers_run(void) {
/* Write out the 32-bit and 64-bit literal macros. */
if (has_32) {
if (strcmp(i32_t_postfix, "") == 0) {
- ConfWriter_append_conf("#define CHY_I32_C(n) n\n");
- ConfWriter_append_conf("#define CHY_U32_C(n) n##%s\n",
- u32_t_postfix);
+ ConfWriter_add_def("I32_C(n)", "n");
+ sprintf(scratch, "n##%s", u32_t_postfix);
+ ConfWriter_add_def("U32_C(n)", scratch);
}
else {
- ConfWriter_append_conf("#define CHY_I32_C(n) n##%s\n",
- i32_t_postfix);
- ConfWriter_append_conf("#define CHY_U32_C(n) n##%s\n",
- u32_t_postfix);
+ sprintf(scratch, "n##%s", i32_t_postfix);
+ ConfWriter_add_def("I32_C(n)", scratch);
+ sprintf(scratch, "n##%s", u32_t_postfix);
+ ConfWriter_add_def("U32_C(n)", scratch);
}
}
if (has_64) {
- ConfWriter_append_conf("#define CHY_I64_C(n) n##%s\n", i64_t_postfix);
- ConfWriter_append_conf("#define CHY_U64_C(n) n##%s\n", u64_t_postfix);
+ sprintf(scratch, "n##%s", i64_t_postfix);
+ ConfWriter_add_def("I64_C(n)", scratch);
+ sprintf(scratch, "n##%s", u64_t_postfix);
+ ConfWriter_add_def("U64_C(n)", scratch);
}
/* Create macro for promoting pointers to integers. */
if (has_64) {
if (sizeof_ptr == 8) {
- ConfWriter_append_conf("#define CHY_PTR_TO_I64(ptr) "
- "((chy_i64_t)(chy_u64_t)(ptr))\n");
+ ConfWriter_add_def("PTR_TO_I64(ptr)",
+ "((chy_i64_t)(chy_u64_t)(ptr))");
}
else {
- ConfWriter_append_conf("#define CHY_PTR_TO_I64(ptr) "
- "((chy_i64_t)(chy_u32_t)(ptr))\n");
+ ConfWriter_add_def("PTR_TO_I64(ptr)",
+ "((chy_i64_t)(chy_u32_t)(ptr))");
}
}
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c Thu Jun 14 00:37:47 2012
@@ -106,8 +106,8 @@ LargeFiles_run(void) {
/* Find off64_t or equivalent. */
found_off64_t = S_probe_off64();
if (found_off64_t) {
- ConfWriter_append_conf("#define CHY_HAS_64BIT_OFFSET_TYPE\n");
- ConfWriter_append_conf("#define chy_off64_t %s\n", off64_type);
+ ConfWriter_add_def("HAS_64BIT_OFFSET_TYPE", NULL);
+ ConfWriter_add_def("off64_t", off64_type);
}
/* See if stdio variants with 64-bit support exist. */
@@ -115,13 +115,13 @@ LargeFiles_run(void) {
stdio64_combo combo = stdio64_combos[i];
if (S_probe_stdio64(&combo)) {
found_stdio64 = true;
- ConfWriter_append_conf("#define CHY_HAS_64BIT_STDIO\n");
+ ConfWriter_add_def("HAS_64BIT_STDIO", NULL);
strcpy(fopen_command, combo.fopen_command);
strcpy(fseek_command, combo.fseek_command);
strcpy(ftell_command, combo.ftell_command);
- ConfWriter_append_conf("#define chy_fopen64 %s\n", fopen_command);
- ConfWriter_append_conf("#define chy_ftello64 %s\n", ftell_command);
- ConfWriter_append_conf("#define chy_fseeko64 %s\n", fseek_command);
+ ConfWriter_add_def("fopen64", fopen_command);
+ ConfWriter_add_def("ftello64", ftell_command);
+ ConfWriter_add_def("fseeko64", fseek_command);
break;
}
}
@@ -132,10 +132,9 @@ LargeFiles_run(void) {
unbuff_combo combo = unbuff_combos[i];
found_lseek = S_probe_lseek(&combo);
if (found_lseek) {
- ConfWriter_append_conf("#define CHY_HAS_64BIT_LSEEK\n");
+ ConfWriter_add_def("HAS_64BIT_LSEEK", NULL);
strcpy(lseek_command, combo.lseek_command);
- ConfWriter_append_conf("#define chy_lseek64 %s\n",
- lseek_command);
+ ConfWriter_add_def("lseek64", lseek_command);
break;
}
}
@@ -143,10 +142,9 @@ LargeFiles_run(void) {
unbuff_combo combo = unbuff_combos[i];
found_pread64 = S_probe_pread64(&combo);
if (found_pread64) {
- ConfWriter_append_conf("#define CHY_HAS_64BIT_PREAD\n");
+ ConfWriter_add_def("HAS_64BIT_PREAD", NULL);
strcpy(pread64_command, combo.pread64_command);
- ConfWriter_append_conf("#define chy_pread64 %s\n",
- pread64_command);
+ ConfWriter_add_def("pread64", pread64_command);
found_pread64 = true;
break;
}
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c Thu Jun 14 00:37:47 2012
@@ -56,7 +56,7 @@ Memory_run(void) {
};
if (chaz_HeadCheck_check_many_headers((const char**)mman_headers)) {
has_sys_mman_h = true;
- chaz_ConfWriter_append_conf("#define CHY_HAS_SYS_MMAN_H\n\n");
+ ConfWriter_add_def("HAS_SYS_MMAN_H", NULL);
}
}
@@ -65,16 +65,16 @@ Memory_run(void) {
if (CC_test_compile(code_buf, strlen(code_buf))) {
has_alloca_h = true;
has_alloca = true;
- ConfWriter_append_conf("#define CHY_HAS_ALLOCA_H\n");
- ConfWriter_append_conf("#define chy_alloca alloca\n");
+ ConfWriter_add_def("HAS_ALLOCA_H", NULL);
+ ConfWriter_add_def("alloca", "alloca");
}
if (!has_alloca) {
sprintf(code_buf, alloca_code, "stdlib.h", "alloca");
if (CC_test_compile(code_buf, strlen(code_buf))) {
has_alloca = true;
need_stdlib_h = true;
- ConfWriter_append_conf("#define CHY_ALLOCA_IN_STDLIB_H\n");
- ConfWriter_append_conf("#define chy_alloca alloca\n");
+ ConfWriter_add_def("ALLOCA_IN_STDLIB_H", NULL);
+ ConfWriter_add_def("alloca", "alloca");
}
}
if (!has_alloca) {
@@ -82,7 +82,7 @@ Memory_run(void) {
"__builtin_alloca");
if (CC_test_compile(code_buf, strlen(code_buf))) {
has_builtin_alloca = true;
- ConfWriter_append_conf("#define chy_alloca __builtin_alloca\n");
+ ConfWriter_add_def("alloca", "__builtin_alloca");
}
}
@@ -92,8 +92,8 @@ Memory_run(void) {
if (CC_test_compile(code_buf, strlen(code_buf))) {
has_malloc_h = true;
has_alloca = true;
- ConfWriter_append_conf("#define CHY_HAS_MALLOC_H\n");
- ConfWriter_append_conf("#define chy_alloca alloca\n");
+ ConfWriter_add_def("HAS_MALLOC_H", NULL);
+ ConfWriter_add_def("alloca", "alloca");
}
}
if (!(has_alloca || has_builtin_alloca)) {
@@ -101,8 +101,8 @@ Memory_run(void) {
if (CC_test_compile(code_buf, strlen(code_buf))) {
has_malloc_h = true;
has_underscore_alloca = true;
- ConfWriter_append_conf("#define CHY_HAS_MALLOC_H\n");
- ConfWriter_append_conf("#define chy_alloca _alloca\n");
+ ConfWriter_add_def("HAS_MALLOC_H", NULL);
+ ConfWriter_add_def("chy_alloca", "_alloca");
}
}
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/SymbolVisibility.c Thu Jun 14 00:37:47 2012
@@ -46,10 +46,8 @@ SymbolVisibility_run(void) {
sprintf(code_buf, symbol_exporting_code, export_win);
if (CC_test_compile(code_buf, strlen(code_buf))) {
can_control_visibility = true;
- ConfWriter_append_conf("#define CHY_EXPORT %s\n", export_win);
- ConfWriter_append_conf(
- "#define CHY_IMPORT __declspec(dllimport)\n"
- );
+ ConfWriter_add_def("EXPORT", export_win);
+ ConfWriter_add_def("IMPORT", "__declspec(dllimport)");
}
}
@@ -59,16 +57,16 @@ SymbolVisibility_run(void) {
sprintf(code_buf, symbol_exporting_code, export_gcc);
if (CC_test_compile(code_buf, strlen(code_buf))) {
can_control_visibility = true;
- ConfWriter_append_conf("#define CHY_EXPORT %s\n", export_gcc);
- ConfWriter_append_conf("#define CHY_IMPORT\n");
+ ConfWriter_add_def("EXPORT", export_gcc);
+ ConfWriter_add_def("IMPORT", NULL);
}
}
CC_set_warnings_as_errors(0);
/* Default. */
if (!can_control_visibility) {
- ConfWriter_append_conf("#define CHY_EXPORT\n");
- ConfWriter_append_conf("#define CHY_IMPORT\n");
+ ConfWriter_add_def("EXPORT", NULL);
+ ConfWriter_add_def("IMPORT", NULL);
}
/* Shorten */
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c Thu Jun 14 00:37:47 2012
@@ -28,8 +28,8 @@ UnusedVars_run(void) {
ConfWriter_start_module("UnusedVars");
/* Write the macros (no test, these are the same everywhere). */
- ConfWriter_append_conf("#define CHY_UNUSED_VAR(x) ((void)x)\n");
- ConfWriter_append_conf("#define CHY_UNREACHABLE_RETURN(type) return (type)0\n");
+ ConfWriter_add_def("UNUSED_VAR(x)", "((void)x)");
+ ConfWriter_add_def("UNREACHABLE_RETURN(type)", "return (type)0");
/* Shorten. */
ConfWriter_start_short_names();
Modified: lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c
URL: http://svn.apache.org/viewvc/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c?rev=1350065&r1=1350064&r2=1350065&view=diff
==============================================================================
--- lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c (original)
+++ lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c Thu Jun 14 00:37:47 2012
@@ -60,8 +60,8 @@ VariadicMacros_run(void) {
if (output != NULL) {
has_varmacros = true;
has_iso_varmacros = true;
- ConfWriter_append_conf("#define CHY_HAS_VARIADIC_MACROS\n");
- ConfWriter_append_conf("#define CHY_HAS_ISO_VARIADIC_MACROS\n");
+ ConfWriter_add_def("HAS_VARIADIC_MACROS", NULL);
+ ConfWriter_add_def("HAS_ISO_VARIADIC_MACROS", NULL);
}
/* Test for GNU-style variadic macros. */
@@ -70,9 +70,9 @@ VariadicMacros_run(void) {
has_gnuc_varmacros = true;
if (has_varmacros == false) {
has_varmacros = true;
- ConfWriter_append_conf("#define CHY_HAS_VARIADIC_MACROS\n");
+ ConfWriter_add_def("HAS_VARIADIC_MACROS", NULL);
}
- ConfWriter_append_conf("#define CHY_HAS_GNUC_VARIADIC_MACROS\n");
+ ConfWriter_add_def("HAS_GNUC_VARIADIC_MACROS", NULL);
}
/* Shorten. */