From fd5edce919ba5a24469faf28d3453086a3ac4df1 Mon Sep 17 00:00:00 2001 From: Martin Konrad Date: Thu, 13 Feb 2020 16:55:01 +0000 Subject: [PATCH] Warn if deprecated state record is used --- documentation/RELEASE_NOTES.md | 6 ++++++ modules/database/src/std/rec/stateRecord.c | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index a5ddca33d..41813be23 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -54,6 +54,12 @@ caget is itself being run from a shell script. caRepeater will now understand the '-v' argument to retain stdin/out/err which may be necessary to see any error messages it may emit. +### `state` record deprecated + +IOCs now emit a warning when a database file containing the `state` record is +loaded. This record has been deprecated for a while and will be removed +beginning with EPICS 7.1. Consider using the `stringin` record instead. + ## EPICS Release 7.0.3.1 **IMPORTANT NOTE:** *Some record types in this release will not be compatible diff --git a/modules/database/src/std/rec/stateRecord.c b/modules/database/src/std/rec/stateRecord.c index fd5b9fba5..78eee9936 100644 --- a/modules/database/src/std/rec/stateRecord.c +++ b/modules/database/src/std/rec/stateRecord.c @@ -28,6 +28,7 @@ #include "errMdef.h" #include "recSup.h" #include "recGbl.h" +#include "errlog.h" #define GEN_SIZE_OFFSET #include "stateRecord.h" @@ -37,7 +38,7 @@ /* Create RSET - Record Support Entry Table*/ #define report NULL #define initialize NULL -#define init_record NULL +static long init_record(struct dbCommon *prec, int pass); static long process(struct dbCommon *); #define special NULL #define get_value NULL @@ -77,6 +78,19 @@ epicsExportAddress(rset,stateRSET); static void monitor(stateRecord *); +static long init_record(struct dbCommon *prec, int pass) +{ + if(pass == 0) { + errlogPrintf( + "WARNING: Using deprecated record type \"state\" for record " + "\"%s\".\nThis record type will be removed beginning with EPICS " + "7.1. Please replace it\nby a stringin record.\n", + prec->name + ); + } + return 0; +} + static long process(struct dbCommon *pcommon) { struct stateRecord *prec = (struct stateRecord *)pcommon;