[120072] branches/release_2_3/base

cal at macports.org cal at macports.org
Wed May 14 15:29:41 PDT 2014


Revision: 120072
          https://trac.macports.org/changeset/120072
Author:   cal at macports.org
Date:     2014-05-14 15:29:40 -0700 (Wed, 14 May 2014)
Log Message:
-----------
Merge r120064, r120067, r120068, r120069 from trunk:

 r120064: base: cregistry: Fix warnings on Linux, stick to a standard, avoid undefined behavior
 r120067: base: machista1.0: Fix warnings on Linux, define feature test macros
 r120068: base: macports1.0: Fix warnings on Linux
 r120069: base: registry2.0: Fix warnings on Linux, define a standards version for the feature test macros

Revision Links:
--------------
    https://trac.macports.org/changeset/120064
    https://trac.macports.org/changeset/120067
    https://trac.macports.org/changeset/120068
    https://trac.macports.org/changeset/120069
    https://trac.macports.org/changeset/120064
    https://trac.macports.org/changeset/120067
    https://trac.macports.org/changeset/120068
    https://trac.macports.org/changeset/120069

Modified Paths:
--------------
    branches/release_2_3/base/src/cregistry/Makefile.in
    branches/release_2_3/base/src/cregistry/registry.c
    branches/release_2_3/base/src/cregistry/registry.h
    branches/release_2_3/base/src/machista1.0/libmachista.c
    branches/release_2_3/base/src/macports1.0/get_systemconfiguration_proxies.c
    branches/release_2_3/base/src/macports1.0/sysctl.c
    branches/release_2_3/base/src/registry2.0/Makefile.in

Property Changed:
----------------
    branches/release_2_3/base/


Property changes on: branches/release_2_3/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/gsoc11-rev-upgrade/base:78828-88375
/branches/gsoc11-statistics/base:79520,79666
/branches/gsoc13-tests:106692-111324
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:118038-118039,118056,118161,118559,118562-118569,118598-118599,118602-118603,118606-118607,118640,119169,119171,119175,119204,119297,119987,119992,120036,120038,120059
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/gsoc11-rev-upgrade/base:78828-88375
/branches/gsoc11-statistics/base:79520,79666
/branches/gsoc13-tests:106692-111324
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:118038-118039,118056,118161,118559,118562-118569,118598-118599,118602-118603,118606-118607,118640,119169,119171,119175,119204,119297,119987,119992,120036,120038,120059,120064,120067-120069
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/release_2_3/base/src/cregistry/Makefile.in
===================================================================
--- branches/release_2_3/base/src/cregistry/Makefile.in	2014-05-14 22:28:52 UTC (rev 120071)
+++ branches/release_2_3/base/src/cregistry/Makefile.in	2014-05-14 22:29:40 UTC (rev 120072)
@@ -12,6 +12,9 @@
 
 include ../../Mk/macports.autoconf.mk
 
+# required for strdup(3) on Linux and OS X
+CPPFLAGS+=-D_XOPEN_SOURCE=600
+
 all:: ${STLIB_NAME} ${SQLEXT_NAME}
 
 .c.o:

Modified: branches/release_2_3/base/src/cregistry/registry.c
===================================================================
--- branches/release_2_3/base/src/cregistry/registry.c	2014-05-14 22:28:52 UTC (rev 120071)
+++ branches/release_2_3/base/src/cregistry/registry.c	2014-05-14 22:29:40 UTC (rev 120072)
@@ -54,6 +54,21 @@
  *       alive at any given time.
  */
 
+/*
+ * Error constants. Those need to be constants and cannot be string literals
+ * because we'll use address comparisons for those and compilers don't have to
+ * guarantee string literals always have the same address (they don't have to
+ * guarantee string literals will have an address at all, so comparing the
+ * address of a string with a string literal is undefined behavior).
+ */
+char *const registry_err_not_found      = "registry::not-found";
+char *const registry_err_invalid        = "registry::invalid";
+char *const registry_err_constraint     = "registry::constraint";
+char *const registry_err_sqlite_error   = "registry::sqlite-error";
+char *const registry_err_misuse         = "registry::misuse";
+char *const registry_err_cannot_init    = "registry::cannot-init";
+char *const registry_err_already_active = "registry::already-active";
+
 /**
  * Destroys a `reg_error` object. This should be called on any reg_error when a
  * registry function returns a failure condition; depending on the function,

Modified: branches/release_2_3/base/src/cregistry/registry.h
===================================================================
--- branches/release_2_3/base/src/cregistry/registry.h	2014-05-14 22:28:52 UTC (rev 120071)
+++ branches/release_2_3/base/src/cregistry/registry.h	2014-05-14 22:29:40 UTC (rev 120072)
@@ -37,14 +37,22 @@
 #include <sqlite3.h>
 #include <tcl.h>
 
-#define REG_NOT_FOUND       "registry::not-found"
-#define REG_INVALID         "registry::invalid"
-#define REG_CONSTRAINT      "registry::constraint"
-#define REG_SQLITE_ERROR    "registry::sqlite-error"
-#define REG_MISUSE          "registry::misuse"
-#define REG_CANNOT_INIT     "registry::cannot-init"
-#define REG_ALREADY_ACTIVE  "registry::already-active"
+#define REG_NOT_FOUND       (registry_err_not_found)
+#define REG_INVALID         (registry_err_invalid)
+#define REG_CONSTRAINT      (registry_err_constraint)
+#define REG_SQLITE_ERROR    (registry_err_sqlite_error)
+#define REG_MISUSE          (registry_err_misuse)
+#define REG_CANNOT_INIT     (registry_err_cannot_init)
+#define REG_ALREADY_ACTIVE  (registry_err_already_active)
 
+extern char *const registry_err_not_found;
+extern char *const registry_err_invalid;
+extern char *const registry_err_constraint;
+extern char *const registry_err_sqlite_error;
+extern char *const registry_err_misuse;
+extern char *const registry_err_cannot_init;
+extern char *const registry_err_already_active;
+
 typedef void reg_error_destructor(const char* description);
 
 typedef struct {

Modified: branches/release_2_3/base/src/machista1.0/libmachista.c
===================================================================
--- branches/release_2_3/base/src/machista1.0/libmachista.c	2014-05-14 22:28:52 UTC (rev 120071)
+++ branches/release_2_3/base/src/machista1.0/libmachista.c	2014-05-14 22:29:40 UTC (rev 120072)
@@ -30,8 +30,15 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
+/* required for asprintf(3) on OS X */
+#define _DARWIN_C_SOURCE
+/* required for asprintf(3) on Linux */
+#define _GNU_SOURCE
+
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -109,14 +116,15 @@
     return result;
 }
 
+#ifdef __MACH__
 const char *macho_get_arch_name (cpu_type_t cputype) {
-#ifdef __MACH__
     const NXArchInfo *archInfo = NXGetArchInfoFromCpuType(cputype, CPU_SUBTYPE_MULTIPLE);	
     if (!archInfo) {
         return NULL;
     }
     return archInfo->name;
 #else
+const char *macho_get_arch_name (cpu_type_t cputype UNUSED) {
     return NULL;
 #endif
 }
@@ -239,8 +247,8 @@
 #endif
 
 /* Parse a Mach-O header */
+#ifdef __MACH__
 static int parse_macho (macho_t *mt, macho_input_t *input) {
-#ifdef __MACH__
     /* Read the file type. */
     const uint32_t *magic = macho_read(input, input->data, sizeof(uint32_t));
     if (magic == NULL)
@@ -437,14 +445,12 @@
     }
 
     return MACHO_SUCCESS;
-#else
-    return 0;
+}
 #endif
-}
 
 /* Parse a (possible Mach-O) file. For a more detailed description, see the header */
+#ifdef __MACH__
 int macho_parse_file(macho_handle_t *handle, const char *filepath, const macho_t **res) {
-#ifdef __MACH__
     int fd;
     struct stat st;
     void *data;
@@ -505,6 +511,7 @@
 
     return ret;
 #else
+int macho_parse_file(macho_handle_t *handle UNUSED, const char *filepath UNUSED, const macho_t **res UNUSED) {
     return 0;
 #endif
 }

Modified: branches/release_2_3/base/src/macports1.0/get_systemconfiguration_proxies.c
===================================================================
--- branches/release_2_3/base/src/macports1.0/get_systemconfiguration_proxies.c	2014-05-14 22:28:52 UTC (rev 120071)
+++ branches/release_2_3/base/src/macports1.0/get_systemconfiguration_proxies.c	2014-05-14 22:29:40 UTC (rev 120072)
@@ -55,7 +55,11 @@
  *
  * Synopsis: array set someArray get_systemconfiguration_proxies
  */
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
 int GetSystemConfigurationProxiesCmd( ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED )
+#else
+int GetSystemConfigurationProxiesCmd( ClientData clientData UNUSED, Tcl_Interp *interp UNUSED, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED )
+#endif
 {
     int cmdResult = TCL_OK;
 #ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION

Modified: branches/release_2_3/base/src/macports1.0/sysctl.c
===================================================================
--- branches/release_2_3/base/src/macports1.0/sysctl.c	2014-05-14 22:28:52 UTC (rev 120071)
+++ branches/release_2_3/base/src/macports1.0/sysctl.c	2014-05-14 22:29:40 UTC (rev 120072)
@@ -49,9 +49,13 @@
 /*
  * Read-only wrapper for sysctlbyname(3). Only works for values of type CTLTYPE_INT and CTLTYPE_QUAD.
  */
+#ifdef HAVE_SYSCTLBYNAME
 int SysctlCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+#else
+int SysctlCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED)
+#endif
 {
-#if HAVE_SYSCTLBYNAME
+#ifdef HAVE_SYSCTLBYNAME
     const char error_message[] = "sysctl failed: ";
     Tcl_Obj *tcl_result;
     int res;

Modified: branches/release_2_3/base/src/registry2.0/Makefile.in
===================================================================
--- branches/release_2_3/base/src/registry2.0/Makefile.in	2014-05-14 22:28:52 UTC (rev 120071)
+++ branches/release_2_3/base/src/registry2.0/Makefile.in	2014-05-14 22:29:40 UTC (rev 120072)
@@ -18,6 +18,8 @@
 
 include $(srcdir)/../../Mk/macports.tea.mk
 
+CPPFLAGS+=-D_XOPEN_SOURCE=600
+
 pkgIndex.tcl: $(SRCS) $(SRCS_AUTOCONF)
 
 CFLAGS+=	${SQLITE3_CFLAGS}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140514/62b39636/attachment.html>


More information about the macports-changes mailing list