Merged changes from upstream

This commit is contained in:
Andrew Johnson
2014-12-23 12:21:37 -06:00
20 changed files with 195 additions and 90 deletions

View File

@@ -52,13 +52,14 @@ BASE_CPPFLAGS += $(OSITHREAD_DEFAULT_STACK_FLAGS_$(OSITHREAD_USE_DEFAULT_STACK))
#---------------------------------------------------------------
# Where to find the installed build tools
# Windows does not like commands with relative paths starting ../
TOOLS = $(EPICS_BASE_HOST_BIN)
TOOLS = $(abspath $(EPICS_BASE_HOST_BIN))
#---------------------------------------------------------------
# Epics base build tools and tool flags
MAKEBPT = $(call PATH_FILTER, $(TOOLS)/makeBpt$(HOSTEXE))
MAKEBPT = $(TOOLS)/makeBpt$(HOSTEXE)
DBEXPAND = $(PERL) $(TOOLS)/dbdExpand.pl
DBTORECORDTYPEH = $(PERL) $(TOOLS)/dbdToRecordtypeH.pl
DBTOMENUH = $(PERL) $(TOOLS)/dbdToMenuH.pl
@@ -80,16 +81,16 @@ REPLACEVAR = $(PERL) $(TOOLS)/replaceVAR.pl
#---------------------------------------------------------------
# private versions of lex/yacc from EPICS
EYACC = $(call PATH_FILTER, $(TOOLS)/antelope$(HOSTEXE))
ELEX = $(call PATH_FILTER, $(TOOLS)/e_flex$(HOSTEXE)) -S$(EPICS_BASE)/include/flex.skel.static
EYACC = $(TOOLS)/antelope$(HOSTEXE)
ELEX = $(TOOLS)/e_flex$(HOSTEXE) -S$(EPICS_BASE)/include/flex.skel.static
YACC = $(EYACC)
LEX = $(ELEX)
#---------------------------------------------------------------
# msi used to be an external tool
# Our use of msi is incompatible with older versions
MSI ?= $(EPICS_BASE_HOST_BIN)/msi
MSI3_15 = $(EPICS_BASE_HOST_BIN)/msi
#---------------------------------------------------------------
# External tools and tool flags - must be in path or defined in application

View File

@@ -314,7 +314,6 @@ LEXOPT += -I
#--------------------------------------------------
# Build compile line here
PATH_FILTER = $(1)
COMPILE.c = $(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES)
COMPILE.cpp = $(CCC) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES)
@@ -346,6 +345,11 @@ TARGET_SRCS = $(foreach name, \
SRC_FILES = $(LIB_SRCS) $(LIBSRCS) $(SRCS) $(USR_SRCS) $(PROD_SRCS) $(TARGET_SRCS)
HDEPENDS_FILES = $(addsuffix $(DEP),$(notdir $(basename $(SRC_FILES))))
#--------------------------------------------------
# Deprecated and no longer used in Base
PATH_FILTER = $(1)$(warning PATH_FILTER is deprecated; used for $(1))
#---------------------------------------------------------------
# Names of installed items
#

View File

@@ -259,23 +259,19 @@ menu%.h$(DEP): ../menu%.dbd
%.db$(RAW)$(DEP): %$(SUBST_SUFFIX)
@$(RM) $@
$(MKMF) -m$@ $(DBFLAGS) $(COMMONDEP_TARGET) $< $(TEMPLATE_FILENAME)
@echo "$(COMMONDEP_TARGET): $(TEMPLATE_FILENAME)" >> $@
@echo "$@: $(TEMPLATE_FILENAME)" >> $@
$(MSI3_15) -D $(DBFLAGS) -o $(COMMONDEP_TARGET) -S$< $(TEMPLATE_FILENAME) > $@
%.db$(RAW)$(DEP): ../%$(SUBST_SUFFIX)
@$(RM) $@
$(MKMF) -m$@ $(DBFLAGS) $(COMMONDEP_TARGET) $< $(TEMPLATE_FILENAME)
@echo "$(COMMONDEP_TARGET): $(TEMPLATE_FILENAME)" >> $@
@echo "$@: $(TEMPLATE_FILENAME)" >> $@
$(MSI3_15) -D $(DBFLAGS) -o $(COMMONDEP_TARGET) -S$< $(TEMPLATE_FILENAME) > $@
%.db$(RAW)$(DEP): %.template
@$(RM) $@
$(MKMF) -m$@ $(DBFLAGS) $(COMMONDEP_TARGET) $<
$(MSI3_15) -D $(DBFLAGS) -o $(COMMONDEP_TARGET) $< > $@
%.db$(RAW)$(DEP): ../%.template
@$(RM) $@
$(MKMF) -m$@ $(DBFLAGS) $(COMMONDEP_TARGET) $<
$(MSI3_15) -D $(DBFLAGS) -o $(COMMONDEP_TARGET) $< > $@
%.acf$(DEP): %.acs
@$(RM) $@
@@ -461,27 +457,27 @@ $(COMMON_DIR)/%.db$(RAW): $(COMMON_DIR)/%.edf
$(COMMON_DIR)/%.db$(RAW): %$(SUBST_SUFFIX)
$(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)"
@$(RM) $@ $*.tmp
$(MSI) $(DBFLAGS) -S$< $(TEMPLATE_FILENAME) > $*.tmp
$(MV) $*.tmp $@
@$(RM) $(notdir $@)
$(MSI3_15) $(DBFLAGS) -o $(notdir $@) -S$< $(TEMPLATE_FILENAME)
@$(MV) $(notdir $@) $@
$(COMMON_DIR)/%.db$(RAW): ../%$(SUBST_SUFFIX)
$(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)"
@$(RM) $@ $*.tmp
$(MSI) $(DBFLAGS) -S$< $(TEMPLATE_FILENAME) > $*.tmp
$(MV) $*.tmp $@
@$(RM) $(notdir $@)
$(MSI3_15) $(DBFLAGS) -o $(notdir $@) -S$< $(TEMPLATE_FILENAME)
@$(MV) $(notdir $@) $@
$(COMMON_DIR)/%.db$(RAW): %.template
$(ECHO) "Inflating database from $<"
@$(RM) $@ $*.tmp
$(MSI) $(DBFLAGS) $< > $*.tmp
$(MV) $*.tmp $@
@$(RM) $(notdir $@)
$(MSI3_15) $(DBFLAGS) -o $(notdir $@) $<
@$(MV) $(notdir $@) $@
$(COMMON_DIR)/%.db$(RAW): ../%.template
$(ECHO) "Inflating database from $<"
@$(RM) $@ $*.tmp
$(MSI) $(DBFLAGS) $< > $*.tmp
$(MV) $*.tmp $@
@$(RM) $(notdir $@)
$(MSI3_15) $(DBFLAGS) -o $(notdir $@) $<
@$(MV) $(notdir $@) $@
$(COMMON_DIR)/%.acf: %.acs
$(ECHO) "Creating acf file $@"

View File

@@ -269,11 +269,13 @@ endif # RANLIB
$(SHRLIBNAME) $(DLLSTUB_LIBNAME) $(TESTSHRLIBNAME) $(TESTDLLSTUB_LIBNAME): \
$(LIBRARY_OBJS) $(LIBRARY_RESS) $(SHRLIB_DEPLIBS)
$(DLLSTUB_LIBNAME): $(SHRLIBNAME)
$(SHRLIBNAME): $(SHRLIB_PREFIX)%$(SHRLIB_SUFFIX):
@$(RM) $@
$(LINK.shrlib)
$(MT_DLL_COMMAND)
$(TESTDLLSTUB_LIBNAME): $(TESTSHRLIBNAME)
$(TESTSHRLIBNAME): $(SHRLIB_PREFIX)%$(SHRLIB_SUFFIX):
@$(RM) $@
$(LINK.shrlib)

View File

@@ -13,10 +13,5 @@ IOS_PLATFORM = iPhoneSimulator
OP_SYS_CFLAGS += -mios-simulator-version-min=$(IOS_DEPLOYMENT_TARGET)
OP_SYS_LDFLAGS += -mios-simulator-version-min=$(IOS_DEPLOYMENT_TARGET)
#
# Architecture-specific information
#
ARCH_CLASS = i386
# Include definitions common to all iOS targets
include $(CONFIG)/os/CONFIG.Common.iosCommon

View File

@@ -10,9 +10,6 @@
#Include definitions common to unix hosts
include $(CONFIG)/os/CONFIG.UnixCommon.Common
# convert UNIX path to native path
PATH_FILTER = $(subst /,\\,$(1))
CP = $(PERL) -MExtUtils::Command -e cp
MV = $(PERL) -MExtUtils::Command -e mv
RM = $(PERL) -MExtUtils::Command -e rm_f

View File

@@ -7,9 +7,6 @@
# Sites may override these definitions in CONFIG_SITE.win32-x86.Common
#-------------------------------------------------------
# convert UNIX path to native path
PATH_FILTER = $(subst /,\\,$(1))
CP = $(PERL) -MExtUtils::Command -e cp
MV = $(PERL) -MExtUtils::Command -e mv
RM = $(PERL) -MExtUtils::Command -e rm_f

View File

@@ -16,11 +16,12 @@
#
# Xcode 4.5 dropped support for the ARMv6.
#
# ARMv8 (arm64) devices: iPhone 5S
# ARMv7s devices: iPhone 5 and 5C, iPad Gen 4
# ARMv7 devices: iPhone 3GS, 4 and 4S, iPod Touch Gen 3 to 5
# iPad Gen 1 to 3, iPad Mini, Apple TV Gen 2 and 3
# ARMv6 devices: iPhone 1 and 3G, iPod Touch Gen 1 and 2
# arm64 devices: iPhone 5S, 6 and 6 Plus, iPad Air Gen 1 and 2,
# iPad Mini Gen 2 and 3
# armv7s devices: iPhone 5 and 5C, iPad Gen 4
# armv7 devices: iPhone 3GS, 4 and 4S, iPod Touch Gen 3 to 5
# iPad Gen 1 to 3, iPad Mini, Apple TV Gen 2 and 3
# armv6 devices: iPhone 1 and 3G, iPod Touch Gen 1 and 2
#ARCH_CLASS = arm64
#ARCH_CLASS = armv7s arm64

View File

@@ -0,0 +1,18 @@
# CONFIG_SITE.Common.ios-x86
#
# $Revision-Id$
#
# Site-specific settings for ios-x86 target builds
#-------------------------------------------------------
# Which x86 instruction set(s) to generate code for:
# The iPhone Simulator now supports both 32-bit and 64-bit
# instruction sets since the iPhone 6 uses a 64-bit CPU.
#
# Apple's compilers can build for multiple architectures,
# generating a Universal binary. This is larger and takes
# longer to compile, but runs efficiently on all devices.
#ARCH_CLASS = i386
ARCH_CLASS = i386 x86_64
#ARCH_CLASS = x86_64

View File

@@ -79,9 +79,9 @@ dbMapper$(DEP): $(COMMON_DIR)/gddApps.h
# Rules for generated files
#
$(COMMON_DIR)/aitConvertGenerated.cc: $(TOOLS)/aitGen$(HOSTEXE)
$(call PATH_FILTER, $(TOOLS)/aitGen$(HOSTEXE)) $@
$(COMMON_DIR)/aitConvertGenerated.cc: $(EPICS_BASE_HOST_BIN)/aitGen$(HOSTEXE)
$(TOOLS)/aitGen$(HOSTEXE) $@
$(COMMON_DIR)/gddApps.h : $(TOOLS)/genApps$(HOSTEXE)
$(call PATH_FILTER, $(TOOLS)/genApps$(HOSTEXE)) $@
$(COMMON_DIR)/gddApps.h : $(EPICS_BASE_HOST_BIN)/genApps$(HOSTEXE)
$(TOOLS)/genApps$(HOSTEXE) $@

View File

@@ -12,5 +12,5 @@
# This is a Makefile fragment, see src/ioc/Makefile.
$(patsubst %,$(COMMON_DIR)/%,$(BPT_DBD)) : \
$(COMMON_DIR)/bpt%.dbd : $(TOOLS)/makeBpt$(HOSTEXE)
$(COMMON_DIR)/bpt%.dbd : $(EPICS_BASE_HOST_BIN)/makeBpt$(HOSTEXE)

View File

@@ -76,6 +76,25 @@ static void inherit_severity(const struct pv_link *ppv_link, dbCommon *pdest,
}
}
/* How to identify links in error messages */
static const char * link_field_name(const struct link *plink)
{
const struct dbCommon *precord = plink->value.pv_link.precord;
const dbRecordType *pdbRecordType = precord->rdes;
dbFldDes * const *papFldDes = pdbRecordType->papFldDes;
const short *link_ind = pdbRecordType->link_ind;
int i;
for (i = 0; i < pdbRecordType->no_links; i++) {
const dbFldDes *pdbFldDes = papFldDes[link_ind[i]];
if (plink == (DBLINK *)((char *)precord + pdbFldDes->offset))
return pdbFldDes->name;
}
return "????";
}
/***************************** Constant Links *****************************/
static long dbConstLoadLink(struct link *plink, short dbrType, void *pbuffer)
@@ -412,9 +431,13 @@ void dbInitLink(struct dbCommon *precord, struct link *plink, short dbfType)
if (pperiod && strstr(pperiod, "PROC")) {
plink->value.pv_link.pvlMask |= pvlOptFWD;
} else {
errlogPrintf("%s.FLNK is a Channel Access Link "
" but does not link to a PROC field\n", precord->name);
}
else {
errlogPrintf("Forward-link uses Channel Access "
"without pointing to PROC field\n"
" %s.%s => %s\n",
precord->name, link_field_name(plink),
plink->value.pv_link.pvname);
}
}
}

View File

@@ -50,7 +50,7 @@ typedef struct lset {
} lset;
#define dbGetSevr(PLINK, PSEVERITY) \
dbGetAlarm((PLINK), NULL, (PSEVERITY));
dbGetAlarm((PLINK), NULL, (PSEVERITY))
epicsShareFunc void dbInitLink(struct dbCommon *precord, struct link *plink,
short dbfType);

View File

@@ -24,6 +24,7 @@
#include <osiFileName.h>
#define MAX_BUFFER_SIZE 4096
#define MAX_DEPS 1024
/* Module to read the template files */
typedef struct inputData inputData;
@@ -47,12 +48,16 @@ static char *substituteGetReplacements(subInfo *pvt);
static char *substituteGetGlobalReplacements(subInfo *pvt);
/* Forward references to local routines */
static void usageExit(void);
static void usageExit(int status);
static void addMacroReplacements(MAC_HANDLE *macPvt, char *pval);
static void makeSubstitutions(inputData *inputPvt, MAC_HANDLE *macPvt, char *templateName);
/*Global variables */
static int opt_V = 0;
static int opt_D = 0;
static char *outFile = 0;
static int numDeps = 0, depHashes[MAX_DEPS];
int main(int argc,char **argv)
@@ -73,24 +78,26 @@ int main(int argc,char **argv)
pval = (narg==1) ? (argv[1]+2) : argv[2];
if(strncmp(argv[1],"-I",2)==0) {
inputAddPath(inputPvt,pval);
} else if (strcmp(argv[1], "-D") == 0) {
opt_D = 1;
narg = 1; /* no argument for this option */
} else if(strncmp(argv[1],"-o",2)==0) {
if(freopen(pval,"w",stdout)==NULL) {
fprintf(stderr,"msi: Can't open %s for writing: %s\n",
pval, strerror(errno));
exit(1);
}
outFile = epicsStrDup(pval);
} else if(strncmp(argv[1],"-M",2)==0) {
addMacroReplacements(macPvt,pval);
} else if(strncmp(argv[1],"-S",2)==0) {
substitutionName = epicsStrDup(pval);
} else if(strncmp(argv[1],"-V",2)==0) {
} else if (strcmp(argv[1], "-V") == 0) {
opt_V = 1;
narg = 1; /* no argument for this option */
} else if(strncmp(argv[1],"-g",2)==0) {
} else if (strcmp(argv[1], "-g") == 0) {
localScope = 0;
narg = 1; /* no argument for this option */
} else if (strcmp(argv[1], "-h") == 0) {
usageExit(0);
} else {
usageExit();
fprintf(stderr, "msi: Bad argument \"%s\"\n", argv[1]);
usageExit(1);
}
argc -= narg;
for(i=1; i<argc; i++) argv[i] = argv[i + narg];
@@ -99,7 +106,19 @@ int main(int argc,char **argv)
macSuppressWarning(macPvt,1);
if(argc>2) {
fprintf(stderr,"msi: Too many arguments\n");
usageExit();
usageExit(1);
}
if (opt_D) {
if (!outFile) {
fprintf(stderr, "msi: Option -D requires -o for Makefile target\n");
exit(1);
}
printf("%s:", outFile);
}
else if (outFile && freopen(outFile, "w", stdout) == NULL) {
fprintf(stderr, "msi: Can't open %s for writing: %s\n",
outFile, strerror(errno));
exit(1);
}
if(argc==2) {
templateName = epicsStrDup(argv[1]);
@@ -122,7 +141,7 @@ int main(int argc,char **argv)
if(templateName) filename = templateName;
if(!filename) {
fprintf(stderr,"msi: No template file\n");
usageExit();
usageExit(1);
}
while((pval = substituteGetReplacements(substitutePvt))){
if (localScope) macPushScope(macPvt);
@@ -137,24 +156,30 @@ int main(int argc,char **argv)
errlogFlush();
macDeleteHandle(macPvt);
inputDestruct(inputPvt);
if (opt_D) {
printf("\n");
}
free(templateName);
free(substitutionName);
return opt_V & 2;
}
void usageExit(void)
void usageExit(int status)
{
fprintf(stderr,"usage: msi [options] [template]\n");
fprintf(stderr,"stdin is used if neither template nor substitution file is given\n");
fprintf(stderr,"options:\n");
fprintf(stderr," -V Undefined macros generate an error\n");
fprintf(stderr," -g All macros have global scope\n");
fprintf(stderr," -o<FILE> Save output to <FILE>\n");
fprintf(stderr," -I<DIR> Add <DIR> to include file search path\n");
fprintf(stderr," -M<SUBST> Add <SUBST> to (global) macro definitions\n");
fprintf(stderr," (<SUBST> takes the form VAR=VALUE,...)\n");
fprintf(stderr," -S<FILE> Expand the substitutions in FILE\n");
exit(1);
fprintf(stderr,
"Usage: msi [options] [template]\n"
" stdin is used if neither template nor substitution file is given\n"
" options:\n"
" -h Print this help message\n"
" -D Output file dependencies, not substitutions\n"
" -V Undefined macros generate an error\n"
" -g All macros have global scope\n"
" -o<FILE> Send output to <FILE>\n"
" -I<DIR> Add <DIR> to include file search path\n"
" -M<SUBST> Add <SUBST> to (global) macro definitions\n"
" (<SUBST> takes the form VAR=VALUE,...)\n"
" -S<FILE> Expand the substitutions in FILE\n");
exit(status);
}
static void addMacroReplacements(MAC_HANDLE *macPvt,char *pval)
@@ -165,13 +190,13 @@ static void addMacroReplacements(MAC_HANDLE *macPvt,char *pval)
status = macParseDefns(macPvt,pval,&pairs);
if(status==-1) {
fprintf(stderr,"msi: Error from macParseDefns\n");
usageExit();
usageExit(1);
}
if(status) {
status = macInstallMacros(macPvt,pairs);
if(!status) {
fprintf(stderr,"Error from macInstallMacros\n");
usageExit();
usageExit(1);
}
free(pairs);
}
@@ -249,7 +274,7 @@ static void makeSubstitutions(inputData *inputPvt, MAC_HANDLE *macPvt, char *tem
expand = 0;
}
endif:
if (expand) {
if (expand && !opt_D) {
n = macExpandString(macPvt,input,buffer,MAX_BUFFER_SIZE-1);
fputs(buffer,stdout);
if (opt_V == 1 && n < 0) {
@@ -432,6 +457,32 @@ static void inputOpenFile(inputData *pinputData,char *filename)
} else {
pinputFile->filename = epicsStrDup("stdin");
}
if (opt_D) {
int hash = epicsStrHash(pinputFile->filename, 12345);
int i = 0;
int match = 0;
while (i < numDeps) {
if (hash == depHashes[i++]) {
match = 1;
break;
}
}
if (!match) {
const char *wrap = numDeps ? " \\\n" : "";
printf("%s %s", wrap, pinputFile->filename);
if (numDeps < MAX_DEPS) {
depHashes[numDeps++] = hash;
}
else {
fprintf(stderr, "msi: More than %d dependencies!\n", MAX_DEPS);
depHashes[0] = hash;
}
}
}
pinputFile->fp = fp;
ellInsert(&pinputData->inputFileList,0,&pinputFile->node);
}

View File

@@ -22,6 +22,6 @@ TARGETS += $(TARGETS_$(BUILD_CLASS))
include $(TOP)/configure/RULES
msi-copy$(EXE): $(INSTALL_BIN)/msi$(EXE) ../Makefile
msi-copy$(EXE): $(INSTALL_BIN)/msi$(EXE)
@$(RM) $@
$(CP) $< $@

View File

@@ -11,23 +11,40 @@
use strict;
use Test;
BEGIN {plan tests => 7}
BEGIN {plan tests => 9}
# Check include/substitute command model
ok(msi('-I .. ../t1-template.txt'), slurp('../t1-result.txt'));
ok(msi('-I.. -S ../t2-substitution.txt'), slurp('../t2-result.txt'));
ok(msi('-I. -I.. -S ../t3-substitution.txt'), slurp('../t3-result.txt'));
ok(msi('-g -I.. -S ../t4-substitution.txt'), slurp('../t4-result.txt'));
ok(msi('-S ../t5-substitute.txt ../t5-template.txt'), slurp('../t5-result.txt'));
ok(msi('-S ../t6-substitute.txt ../t6-template.txt'), slurp('../t6-result.txt'));
# Check -o works
# Substitution file, dbLoadTemplate format
ok(msi('-I.. -S ../t2-substitution.txt'), slurp('../t2-result.txt'));
# Macro scoping
ok(msi('-I. -I.. -S ../t3-substitution.txt'), slurp('../t3-result.txt'));
# Global scope (backwards compatibility check)
ok(msi('-g -I.. -S ../t4-substitution.txt'), slurp('../t4-result.txt'));
# Substitution file, regular format
ok(msi('-S ../t5-substitute.txt ../t5-template.txt'), slurp('../t5-result.txt'));
# Substitution file, pattern format
ok(msi('-S../t6-substitute.txt ../t6-template.txt'), slurp('../t6-result.txt'));
# Output option -o
my $out = 't7-output.txt';
unlink $out;
msi("-I.. -o $out ../t1-template.txt");
ok(slurp($out), slurp('../t1-result.txt'));
# Dependency generation, include/substitute model
ok(msi('-I.. -D -o t8.txt ../t1-template.txt'), slurp('../t8-result.txt'));
# Support routines
# Dependency generation, dbLoadTemplate format
ok(msi('-I.. -D -ot9.txt -S ../t2-substitution.txt'), slurp('../t9-result.txt'));
# Test support routines
sub slurp {
my ($file) = @_;

View File

@@ -0,0 +1,2 @@
t8.txt: ../t1-template.txt \
../t1-include.txt

View File

@@ -0,0 +1 @@
t9.txt: ../t2-template.txt

View File

@@ -16,6 +16,6 @@ asLib$(DEP): asLib_lex.c
asLib.c: asLib_lex.c
# Ensure that lexer and parser are built before they are needed
asLib.c: $(TOOLS)/antelope$(HOSTEXE)
asLib_lex.c: $(TOOLS)/e_flex$(HOSTEXE)
asLib.c: $(EPICS_BASE_HOST_BIN)/antelope$(HOSTEXE)
asLib_lex.c: $(EPICS_BASE_HOST_BIN)/e_flex$(HOSTEXE)
asLib_lex.c: $(INSTALL_INCLUDE)/flex.skel.static

View File

@@ -10,4 +10,4 @@
# This is a Makefile fragment, see src/libCom/Makefile.
# Ensure that the lexer is built before it is needed
parse.c: $(TOOLS)/antelope$(HOSTEXE)
parse.c: $(EPICS_BASE_HOST_BIN)/antelope$(HOSTEXE)