From 958aa02320cb2b7f4fe264a10722b92acd316ccc Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 20 Aug 2012 10:03:50 -0500 Subject: [PATCH 1/9] Change build defaults for darwin-x86 * Use clang and clang++ * Build for x86_64 only --- configure/os/CONFIG_SITE.Common.darwin-x86 | 12 ++++++------ documentation/RELEASE_NOTES.html | 7 +++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/configure/os/CONFIG_SITE.Common.darwin-x86 b/configure/os/CONFIG_SITE.Common.darwin-x86 index 7aad1537e..f215c8e5e 100644 --- a/configure/os/CONFIG_SITE.Common.darwin-x86 +++ b/configure/os/CONFIG_SITE.Common.darwin-x86 @@ -10,14 +10,14 @@ # i386 # x86_64 - Needs MacOS 10.4 with the Universal SDK, or 10.5 and later -ARCH_CLASS = i386 -#ARCH_CLASS = x86_64 +#ARCH_CLASS = i386 +ARCH_CLASS = x86_64 #ARCH_CLASS = i386 x86_64 # -# Uncomment the followings lines to build with CLANG instead of GCC. +# Comment out the followings 3 lines to build with GCC instead of CLANG. # -#CC = clang -#CCC = clang++ -#GNU_LDLIBS_YES = +CC = clang +CCC = clang++ +GNU = NO diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 3c5ba6836..47babb91b 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,13 @@ +

MacOS build defaults changed

+ +

The default build settings for darwin-x86 targets have been changed to match +the latest version of XCode; see configure/os/CONFIG_SITE.Common.darwin-x86 +if you need to revert back to building with GCC or to include the i386 CPU +architecture.

+

Build problem with db dependencies

The dependency output for .db and .acf files created by makeDbDepends.pl did From 5c2ef73c4a11fa15331231737d744ec607ce6307 Mon Sep 17 00:00:00 2001 From: Janet Anderson Date: Mon, 20 Aug 2012 12:27:39 -0500 Subject: [PATCH 2/9] Fixed X11 include definitions, X11_INC and XPM_INC. --- .../top/configure/os/CONFIG_SITE.darwin-x86.darwin-x86 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/makeBaseExt/top/configure/os/CONFIG_SITE.darwin-x86.darwin-x86 b/src/makeBaseExt/top/configure/os/CONFIG_SITE.darwin-x86.darwin-x86 index fe8cd431e..522510666 100644 --- a/src/makeBaseExt/top/configure/os/CONFIG_SITE.darwin-x86.darwin-x86 +++ b/src/makeBaseExt/top/configure/os/CONFIG_SITE.darwin-x86.darwin-x86 @@ -28,9 +28,9 @@ PYTHON_INCLUDE=/System/Library/Frameworks/Python.framework/Versions/2.3/include/ # XDarwin # X11_LIB=/usr/X11R6/lib -X11_INC=/usr/X11R6/include/X11 +X11_INC=/usr/X11R6/include XPM_LIB=/usr/X11R6/lib -XPM_INC=/usr/X11R6/include/X11 +XPM_INC=/usr/X11R6/include # # Fink OpenMotif From 1ac8ff6378931fb645d46497211f034b89af77a5 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 28 Aug 2012 16:35:52 -0500 Subject: [PATCH 3/9] as: Make asSetFilename() warn on relative paths Tell the user if they try this. They'll get an error from asInit() later, but it gets lost easily in other noise. --- src/as/asDbLib.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/as/asDbLib.c b/src/as/asDbLib.c index a838444c9..e4055101e 100644 --- a/src/as/asDbLib.c +++ b/src/as/asDbLib.c @@ -1,11 +1,9 @@ -/* share/src/as/asDbLib.c */ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* Author: Marty Kraimer Date: 02-11-94*/ @@ -69,18 +67,23 @@ static long asDbAddRecords(void) int epicsShareAPI asSetFilename(const char *acf) { - if(pacf) free ((void *)pacf); - if(acf) { - pacf = calloc(1,strlen(acf)+1); - if(!pacf) { - errMessage(0,"asSetFilename calloc failure"); - } else { - strcpy(pacf,acf); - } + if (pacf) + free (pacf); + if (acf) { + pacf = calloc(1, strlen(acf)+1); + if (!pacf) { + errMessage(0, "asSetFilename calloc failure"); + } else { + strcpy(pacf, acf); + if (*pacf != '/' && !strchr(pacf, ':')) { + printf("asSetFilename: Warning - relative paths won't usually " + "work\n"); + } + } } else { - pacf = NULL; + pacf = NULL; } - return(0); + return 0; } int epicsShareAPI asSetSubstitutions(const char *substitutions) From a19e1d21da1707c55e51db25d97c51743ff2b67e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 31 Aug 2012 15:57:59 -0500 Subject: [PATCH 4/9] libCom: Fix epicsSnprintf() under MinGW Use the Microsoft _vscprintf() function which was just missing a prototype in earlier versions of MinGW's stdio.h header. --- src/libCom/osi/os/WIN32/osdStdio.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdStdio.c b/src/libCom/osi/os/WIN32/osdStdio.c index 602651f8b..8a2d58ea9 100644 --- a/src/libCom/osi/os/WIN32/osdStdio.c +++ b/src/libCom/osi/os/WIN32/osdStdio.c @@ -11,6 +11,11 @@ #include #include +#ifndef _MSC_VER +/* Older versions of MinGW omitted this prototype from stdio.h */ +_CRTIMP int __cdecl __MINGW_NOTHROW _vscprintf (const char*, va_list); +#endif + #define epicsExportSharedSymbols #include "epicsStdio.h" @@ -18,26 +23,12 @@ int epicsShareAPI epicsVsnprintf(char *str, size_t len, const char *fmt, va_list ap) { int retval = _vsnprintf(str, len, fmt, ap); - -#ifdef _MSC_VER int needed = _vscprintf(fmt, ap); if ((int) len < needed + 1) { str[len - 1] = 0; return needed; } -#else - /* Unfortunately MINGW doesn't provide _vscprintf and their - * _vsnprintf follows MS' broken return value semantics. - */ - if (retval == -1) { - if (len) - str[len - 1] = 0; - return len; - } else if (retval == (int) len) { - str[--retval] = 0; - } -#endif return retval; } From 169b30081a16d0772f62f20b959f19317b890b1d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 31 Aug 2012 16:05:14 -0500 Subject: [PATCH 5/9] Fix for vxWorks 6.x LED_ID Use LED_ID in epicsReadline.c Provide a typedef for vxWorks 5.x where it doesn't exist. --- src/libCom/osi/os/default/epicsReadline.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libCom/osi/os/default/epicsReadline.c b/src/libCom/osi/os/default/epicsReadline.c index 20d5e0b79..6c442e376 100644 --- a/src/libCom/osi/os/default/epicsReadline.c +++ b/src/libCom/osi/os/default/epicsReadline.c @@ -189,8 +189,12 @@ epicsReadlineEnd (void *context) #include #define LEDLIB_LINESIZE 1000 +#ifndef _WRS_VXWORKS_MAJOR +typedef int LED_ID; +#endif + struct readlineContext { - int ledId; + LED_ID ledId; char line[LEDLIB_LINESIZE]; FILE *in; }; @@ -205,7 +209,7 @@ epicsReadlineBegin(FILE *in) readlineContext = malloc(sizeof *readlineContext); if (readlineContext != NULL) { - readlineContext->ledId = ERROR; + readlineContext->ledId = (LED_ID) ERROR; readlineContext->in = in; if (in == NULL) { long i = 50; @@ -213,7 +217,7 @@ epicsReadlineBegin(FILE *in) envGetLongConfigParam(&IOCSH_HISTSIZE, &i); if (i < 1) i = 1; readlineContext->ledId = ledOpen(fileno(stdin), fileno(stdout), i); - if (readlineContext->ledId == ERROR) { + if (readlineContext->ledId == (LED_ID) ERROR) { readlineContext->in = stdin; printf("Warning -- Unabled to allocate space for command-line history.\n"); printf("Warning -- Command-line editting disabled.\n"); @@ -236,7 +240,7 @@ epicsReadline (const char *prompt, void *context) fputs(prompt, stdout); fflush(stdout); } - if (readlineContext->ledId != ERROR) { + if (readlineContext->ledId != (LED_ID) ERROR) { i = ledRead(readlineContext->ledId, readlineContext->line, LEDLIB_LINESIZE-1); if (i < 0) return NULL; @@ -262,7 +266,7 @@ epicsReadlineEnd (void *context) struct readlineContext *readlineContext = context; if (readlineContext) { - if (readlineContext->ledId != ERROR) + if (readlineContext->ledId != (LED_ID) ERROR) ledClose(readlineContext->ledId); free(readlineContext); } From 709b6ef2f32fc728b7d1b6714d4cd67de4e07448 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Mon, 3 Sep 2012 21:25:44 +0200 Subject: [PATCH 6/9] catools: Fix off-by-one bug in caput An internal buffer was allocated one char too short, when caput was used with the '-S' (send string as array of chars) option. Reported by J. Lewis Muir (tech-talk on 17-Aug-2012) --- src/catools/caput.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/catools/caput.c b/src/catools/caput.c index cea443c0d..9e1adcd46 100644 --- a/src/catools/caput.c +++ b/src/catools/caput.c @@ -492,12 +492,12 @@ int main (int argc, char *argv[]) if (charArrAsStr) { count = len; dbrType = DBR_CHAR; - ebuf = calloc(strlen(cbuf), sizeof(char)); + ebuf = calloc(strlen(cbuf)+1, sizeof(char)); if(!ebuf) { fprintf(stderr, "Memory allocation failed\n"); return 1; } - epicsStrnRawFromEscaped(ebuf, strlen(cbuf), cbuf, strlen(cbuf)); + epicsStrnRawFromEscaped(ebuf, strlen(cbuf)+1, cbuf, strlen(cbuf)); } else { for (i = 0; i < count; ++i) { epicsStrnRawFromEscaped(sbuf[i], sizeof(EpicsStr), *(argv+optind+i), sizeof(EpicsStr)); From 7e6e38060fffaeb47faf1415cfc55c29a7ddc620 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 11 Sep 2012 16:58:43 +0200 Subject: [PATCH 7/9] catools: Change behaviour of camonitor when printing array of chars as string camonitor was using strlen() to find out the length of the array to print as %s string, which led to printing old buffer contents when the array-string was not null terminated. Now uses the minimum of strlen(), elements received, and elements requested. Suggested by Mark Rivers on tech-talk (11 Sep 2012) --- src/catools/tool_lib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/catools/tool_lib.c b/src/catools/tool_lib.c index 13d6330cf..380457756 100644 --- a/src/catools/tool_lib.c +++ b/src/catools/tool_lib.c @@ -445,10 +445,13 @@ char *dbr2str (const void *value, unsigned type) \ if (charArrAsStr && dbr_type_is_CHAR(TYPE_ENUM) && (reqElems || pv->nElems > 1)) { \ dbr_char_t *s = (dbr_char_t*) dbr_value_ptr(pv->value, pv->dbrType); \ - int dlen = epicsStrnEscapedFromRawSize((char*)s, strlen((char*)s)); \ + size_t len = strlen((char*)s); \ + unsigned long elems = reqElems && (reqElems < pv->nElems) ? reqElems : pv->nElems; \ + if (len < elems) elems = len; \ + int dlen = epicsStrnEscapedFromRawSize((char*)s, elems); \ char *d = calloc(dlen+1, sizeof(char)); \ if(d) { \ - epicsStrnEscapedFromRaw(d, dlen+1, (char*)s, strlen((char*)s));\ + epicsStrnEscapedFromRaw(d, dlen+1, (char*)s, elems); \ printf("%c%s", fieldSeparator, d); \ free(d); \ } else { \ From 47905789537df7bbe52905ff3771c02585ff7674 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 11 Sep 2012 12:11:55 -0500 Subject: [PATCH 8/9] tools: Try harder to collapse ../ components in AbsPath Idea from Angus Gratton, ANU --- src/tools/EPICS/Path.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/EPICS/Path.pm b/src/tools/EPICS/Path.pm index ba6ad4a9b..83a91efb3 100644 --- a/src/tools/EPICS/Path.pm +++ b/src/tools/EPICS/Path.pm @@ -123,6 +123,7 @@ sub AbsPath { # Now calculate the absolute path my $abs = File::Spec->rel2abs($path, abs_path($cwd)); + $abs = abs_path($abs) if -e $abs; return LocalPath($abs); } From c574722a9bf9fc0bf37e4e58bdac4a96f2c62f36 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 11 Sep 2012 15:19:29 -0500 Subject: [PATCH 9/9] catools: Fix syntax error from vxWorks gcc. --- src/catools/tool_lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/catools/tool_lib.c b/src/catools/tool_lib.c index 380457756..ddead1115 100644 --- a/src/catools/tool_lib.c +++ b/src/catools/tool_lib.c @@ -447,9 +447,11 @@ char *dbr2str (const void *value, unsigned type) dbr_char_t *s = (dbr_char_t*) dbr_value_ptr(pv->value, pv->dbrType); \ size_t len = strlen((char*)s); \ unsigned long elems = reqElems && (reqElems < pv->nElems) ? reqElems : pv->nElems; \ + int dlen; \ + char *d; \ if (len < elems) elems = len; \ - int dlen = epicsStrnEscapedFromRawSize((char*)s, elems); \ - char *d = calloc(dlen+1, sizeof(char)); \ + dlen = epicsStrnEscapedFromRawSize((char*)s, elems); \ + d = calloc(dlen+1, sizeof(char)); \ if(d) { \ epicsStrnEscapedFromRaw(d, dlen+1, (char*)s, elems); \ printf("%c%s", fieldSeparator, d); \