Merge ~bhill/epics-base:EPICS-and-CA-version-from-CA-tools into ~epics-core/epics-base/+git/epics-base:3.15

Proposed by Bruce Hill
Status: Merged
Merged at revision: 937878e0a98e6835f272a22f9e03a342ae1a6e72
Proposed branch: ~bhill/epics-base:EPICS-and-CA-version-from-CA-tools
Merge into: ~epics-core/epics-base/+git/epics-base:3.15
Diff against target: 153 lines (+26/-5)
4 files modified
src/ca/client/tools/caget.c (+6/-1)
src/ca/client/tools/cainfo.c (+7/-1)
src/ca/client/tools/camonitor.c (+7/-2)
src/ca/client/tools/caput.c (+6/-1)
Reviewer Review Type Date Requested Status
mdavidsaver Approve
Andrew Johnson Approve
Review via email: mp+358142@code.launchpad.net

Description of the change

Adds a -V command line argument to caget, cainfo, camonitor, and caput to display the EPICS version string and the CA protocol version.

To post a comment you must log in.
Revision history for this message
mdavidsaver (mdavidsaver) wrote :

I like the idea of '-V', but some cleanup is needed. There is no reason to change all of the includes (back) from brackets '<>' to quotes '""'. Also, please maintain consistent indentation! Switch statements are hard enough to parse as it is.

review: Needs Fixing
Revision history for this message
Bruce Hill (bhill) wrote :

> There is no reason to
> change all of the includes (back) from brackets '<>' to quotes '""'.

I've backed out these changes but am not clear why you object.
As a general rule, all EPICS headers should be included with quotes to
make sure object files get rebuilt when needed. I'm often switching
IOC's and modules to build w/ different base releases, and if I'm working
on bugs or features in base, files should get recompiled if any of the
EPICS headers change.

There is little advantage to using brackets for your include statements.
At best you get a slight increase in compile time, but we could have
more impact by working on our makefiles to reduce all the unnecessary
implicit rules and prerequisites that cause make to look for non-existent files.

I'm inclined to submit the #include line changes as their own change request.
Any objections?

Revision history for this message
Andrew Johnson (anj) wrote :

@Bruce What version of gcc are you using? Since gcc 3.x the -MM flag that we use to generate dependency files has ignored the type of quote mark used. However if you are building for VxWorks 5.5 or earlier it apparently does still matter. Here's a quote from the cpp.info file from VxWorks 5.5.2:

`-MM [-MG]'
     Like `-M' but mention only the files included with `#include
     "FILE"'. System header files included with `#include <FILE>' are
     omitted.

and from a more recent gcc (4.x)

'-MM'
     Like '-M' but do not mention header files that are found in system
     header directories, nor header files that are included, directly or
     indirectly, from such a header.

     This implies that the choice of angle brackets or double quotes in
     an '#include' directive does not in itself determine whether that
     header will appear in '-MM' dependency output. This is a slight
     change in semantics from GCC versions 3.0 and earlier.

I will switch older VxWorks builds to use the mkmf.pl script for dependency generation. It would be too disruptive to try and fix all of our source files at this point, and this it just a 2-line fix (diff against 3.15):

index 875fe81..95f8f7f 100644
--- a/configure/os/CONFIG.Common.vxWorksCommon
+++ b/configure/os/CONFIG.Common.vxWorksCommon
@@ -186,6 +186,12 @@ VXCPPFLAGS = $(filter-out $(OP_SYS_INCLUDE_CPPFLAGS),$(CPPFLAGS))
 PREPROCESS.cpp = $(CPP) $(VXCPPFLAGS) $(INCLUDES) $< > $@

 #--------------------------------------------------
+# Don't use gcc 2.x for dependency generation
+
+HDEPENDS_METHOD_2 = MKMF
+HDEPENDS_METHOD = $(firstword $(HDEPENDS_METHOD_$(VX_GNU_MAJOR_VERSION)) COMP)
+
+#--------------------------------------------------
 # Allow site overrides
 -include $(CONFIG)/os/CONFIG_SITE.Common.vxWorksCommon
 -include $(CONFIG)/os/CONFIG_SITE.$(EPICS_HOST_ARCH).vxWorksCommon

- Andrew

review: Approve
Revision history for this message
Bruce Hill (bhill) wrote :

You're right. Old habits die hard.

Revision history for this message
mdavidsaver (mdavidsaver) wrote :

Looks fine now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/ca/client/tools/caget.c b/src/ca/client/tools/caget.c
index 0005670..75225d0 100644
--- a/src/ca/client/tools/caget.c
+++ b/src/ca/client/tools/caget.c
@@ -34,6 +34,7 @@
34#include <alarm.h>34#include <alarm.h>
35#include <cadef.h>35#include <cadef.h>
36#include <epicsGetopt.h>36#include <epicsGetopt.h>
37#include "epicsVersion.h"
3738
38#include "tool_lib.h"39#include "tool_lib.h"
3940
@@ -55,6 +56,7 @@ static void usage (void)
55{56{
56 fprintf (stderr, "\nUsage: caget [options] <PV name> ...\n\n"57 fprintf (stderr, "\nUsage: caget [options] <PV name> ...\n\n"
57 " -h: Help: Print this message\n"58 " -h: Help: Print this message\n"
59 " -V: Version: Show EPICS and CA versions\n"
58 "Channel Access options:\n"60 "Channel Access options:\n"
59 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"61 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"
60 " -c: Asynchronous get (use ca_get_callback and wait for completion)\n"62 " -c: Asynchronous get (use ca_get_callback and wait for completion)\n"
@@ -389,11 +391,14 @@ int main (int argc, char *argv[])
389391
390 LINE_BUFFER(stdout); /* Configure stdout buffering */392 LINE_BUFFER(stdout); /* Configure stdout buffering */
391393
392 while ((opt = getopt(argc, argv, ":taicnhsSe:f:g:l:#:d:0:w:p:F:")) != -1) {394 while ((opt = getopt(argc, argv, ":taicnhsSVe:f:g:l:#:d:0:w:p:F:")) != -1) {
393 switch (opt) {395 switch (opt) {
394 case 'h': /* Print usage */396 case 'h': /* Print usage */
395 usage();397 usage();
396 return 0;398 return 0;
399 case 'V':
400 printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
401 return 0;
397 case 't': /* Terse output mode */402 case 't': /* Terse output mode */
398 complainIfNotPlainAndSet(&format, terse);403 complainIfNotPlainAndSet(&format, terse);
399 break;404 break;
diff --git a/src/ca/client/tools/cainfo.c b/src/ca/client/tools/cainfo.c
index ad580f4..fc18ccd 100644
--- a/src/ca/client/tools/cainfo.c
+++ b/src/ca/client/tools/cainfo.c
@@ -23,6 +23,7 @@
2323
24#include <stdio.h>24#include <stdio.h>
25#include <epicsStdlib.h>25#include <epicsStdlib.h>
26#include "epicsVersion.h"
2627
27#include <cadef.h>28#include <cadef.h>
28#include <epicsGetopt.h>29#include <epicsGetopt.h>
@@ -36,12 +37,14 @@ void usage (void)
36{37{
37 fprintf (stderr, "\nUsage: cainfo [options] <PV name> ...\n\n"38 fprintf (stderr, "\nUsage: cainfo [options] <PV name> ...\n\n"
38 " -h: Help: Print this message\n"39 " -h: Help: Print this message\n"
40 " -V: Version: Show EPICS and CA versions\n"
39 "Channel Access options:\n"41 "Channel Access options:\n"
40 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"42 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"
41 " -s <level>: Call ca_client_status with the specified interest level\n"43 " -s <level>: Call ca_client_status with the specified interest level\n"
42 " -p <prio>: CA priority (0-%u, default 0=lowest)\n"44 " -p <prio>: CA priority (0-%u, default 0=lowest)\n"
43 "\nExample: cainfo my_channel another_channel\n\n"45 "\nExample: cainfo my_channel another_channel\n\n"
44 , DEFAULT_TIMEOUT, CA_PRIORITY_MAX);46 , DEFAULT_TIMEOUT, CA_PRIORITY_MAX);
47 fprintf (stderr, "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
45}48}
4649
4750
@@ -137,11 +140,14 @@ int main (int argc, char *argv[])
137140
138 LINE_BUFFER(stdout); /* Configure stdout buffering */141 LINE_BUFFER(stdout); /* Configure stdout buffering */
139142
140 while ((opt = getopt(argc, argv, ":nhw:s:p:")) != -1) {143 while ((opt = getopt(argc, argv, ":nhVw:s:p:")) != -1) {
141 switch (opt) {144 switch (opt) {
142 case 'h': /* Print usage */145 case 'h': /* Print usage */
143 usage();146 usage();
144 return 0;147 return 0;
148 case 'V':
149 printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
150 return 0;
145 case 'w': /* Set CA timeout value */151 case 'w': /* Set CA timeout value */
146 if(epicsScanDouble(optarg, &caTimeout) != 1)152 if(epicsScanDouble(optarg, &caTimeout) != 1)
147 {153 {
diff --git a/src/ca/client/tools/camonitor.c b/src/ca/client/tools/camonitor.c
index 307dad8..a3fdecd 100644
--- a/src/ca/client/tools/camonitor.c
+++ b/src/ca/client/tools/camonitor.c
@@ -26,6 +26,7 @@
26#include <stdio.h>26#include <stdio.h>
27#include <epicsStdlib.h>27#include <epicsStdlib.h>
28#include <string.h>28#include <string.h>
29#include "epicsVersion.h"
2930
30#include <cadef.h>31#include <cadef.h>
31#include <epicsGetopt.h>32#include <epicsGetopt.h>
@@ -44,7 +45,8 @@ void usage (void)
44{45{
45 fprintf (stderr, "\nUsage: camonitor [options] <PV name> ...\n"46 fprintf (stderr, "\nUsage: camonitor [options] <PV name> ...\n"
46 "\n"47 "\n"
47 " -h: Help; Print this message\n"48 " -h: Help: Print this message\n"
49 " -V: Version: Show EPICS and CA versions\n"
48 "Channel Access options:\n"50 "Channel Access options:\n"
49 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"51 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"
50 " -m <msk>: Specify CA event mask to use. <msk> is any combination of\n"52 " -m <msk>: Specify CA event mask to use. <msk> is any combination of\n"
@@ -209,11 +211,14 @@ int main (int argc, char *argv[])
209211
210 LINE_BUFFER(stdout); /* Configure stdout buffering */212 LINE_BUFFER(stdout); /* Configure stdout buffering */
211213
212 while ((opt = getopt(argc, argv, ":nhm:sSe:f:g:l:#:0:w:t:p:F:")) != -1) {214 while ((opt = getopt(argc, argv, ":nhVm:sSe:f:g:l:#:0:w:t:p:F:")) != -1) {
213 switch (opt) {215 switch (opt) {
214 case 'h': /* Print usage */216 case 'h': /* Print usage */
215 usage();217 usage();
216 return 0;218 return 0;
219 case 'V':
220 printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
221 return 0;
217 case 'n': /* Print ENUM as index numbers */222 case 'n': /* Print ENUM as index numbers */
218 enumAsNr=1;223 enumAsNr=1;
219 break;224 break;
diff --git a/src/ca/client/tools/caput.c b/src/ca/client/tools/caput.c
index 5e4d10e..79ffef8 100644
--- a/src/ca/client/tools/caput.c
+++ b/src/ca/client/tools/caput.c
@@ -37,6 +37,7 @@
37#include <epicsGetopt.h>37#include <epicsGetopt.h>
38#include <epicsEvent.h>38#include <epicsEvent.h>
39#include <epicsString.h>39#include <epicsString.h>
40#include "epicsVersion.h"
4041
41#include "tool_lib.h"42#include "tool_lib.h"
4243
@@ -59,6 +60,7 @@ void usage (void)
59 fprintf (stderr, "\nUsage: caput [options] <PV name> <PV value> ...\n"60 fprintf (stderr, "\nUsage: caput [options] <PV name> <PV value> ...\n"
60 " caput -a [options] <PV name> <no of values> <PV value> ...\n\n"61 " caput -a [options] <PV name> <no of values> <PV value> ...\n\n"
61 " -h: Help: Print this message\n"62 " -h: Help: Print this message\n"
63 " -V: Version: Show EPICS and CA versions\n"
62 "Channel Access options:\n"64 "Channel Access options:\n"
63 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"65 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"
64 " -c: Asynchronous put (use ca_put_callback and wait for completion)\n"66 " -c: Asynchronous put (use ca_put_callback and wait for completion)\n"
@@ -281,11 +283,14 @@ int main (int argc, char *argv[])
281 LINE_BUFFER(stdout); /* Configure stdout buffering */283 LINE_BUFFER(stdout); /* Configure stdout buffering */
282 putenv("POSIXLY_CORRECT="); /* Behave correct on GNU getopt systems */284 putenv("POSIXLY_CORRECT="); /* Behave correct on GNU getopt systems */
283285
284 while ((opt = getopt(argc, argv, ":cnlhatsS#:w:p:F:")) != -1) {286 while ((opt = getopt(argc, argv, ":cnlhatsVS#:w:p:F:")) != -1) {
285 switch (opt) {287 switch (opt) {
286 case 'h': /* Print usage */288 case 'h': /* Print usage */
287 usage();289 usage();
288 return 0;290 return 0;
291 case 'V':
292 printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
293 return 0;
289 case 'n': /* Force interpret ENUM as index number */294 case 'n': /* Force interpret ENUM as index number */
290 enumAsNr = 1;295 enumAsNr = 1;
291 enumAsString = 0;296 enumAsString = 0;

Subscribers

People subscribed via source and target branches