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
1diff --git a/src/ca/client/tools/caget.c b/src/ca/client/tools/caget.c
2index 0005670..75225d0 100644
3--- a/src/ca/client/tools/caget.c
4+++ b/src/ca/client/tools/caget.c
5@@ -34,6 +34,7 @@
6 #include <alarm.h>
7 #include <cadef.h>
8 #include <epicsGetopt.h>
9+#include "epicsVersion.h"
10
11 #include "tool_lib.h"
12
13@@ -55,6 +56,7 @@ static void usage (void)
14 {
15 fprintf (stderr, "\nUsage: caget [options] <PV name> ...\n\n"
16 " -h: Help: Print this message\n"
17+ " -V: Version: Show EPICS and CA versions\n"
18 "Channel Access options:\n"
19 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"
20 " -c: Asynchronous get (use ca_get_callback and wait for completion)\n"
21@@ -389,11 +391,14 @@ int main (int argc, char *argv[])
22
23 LINE_BUFFER(stdout); /* Configure stdout buffering */
24
25- while ((opt = getopt(argc, argv, ":taicnhsSe:f:g:l:#:d:0:w:p:F:")) != -1) {
26+ while ((opt = getopt(argc, argv, ":taicnhsSVe:f:g:l:#:d:0:w:p:F:")) != -1) {
27 switch (opt) {
28 case 'h': /* Print usage */
29 usage();
30 return 0;
31+ case 'V':
32+ printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
33+ return 0;
34 case 't': /* Terse output mode */
35 complainIfNotPlainAndSet(&format, terse);
36 break;
37diff --git a/src/ca/client/tools/cainfo.c b/src/ca/client/tools/cainfo.c
38index ad580f4..fc18ccd 100644
39--- a/src/ca/client/tools/cainfo.c
40+++ b/src/ca/client/tools/cainfo.c
41@@ -23,6 +23,7 @@
42
43 #include <stdio.h>
44 #include <epicsStdlib.h>
45+#include "epicsVersion.h"
46
47 #include <cadef.h>
48 #include <epicsGetopt.h>
49@@ -36,12 +37,14 @@ void usage (void)
50 {
51 fprintf (stderr, "\nUsage: cainfo [options] <PV name> ...\n\n"
52 " -h: Help: Print this message\n"
53+ " -V: Version: Show EPICS and CA versions\n"
54 "Channel Access options:\n"
55 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"
56 " -s <level>: Call ca_client_status with the specified interest level\n"
57 " -p <prio>: CA priority (0-%u, default 0=lowest)\n"
58 "\nExample: cainfo my_channel another_channel\n\n"
59 , DEFAULT_TIMEOUT, CA_PRIORITY_MAX);
60+ fprintf (stderr, "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
61 }
62
63
64@@ -137,11 +140,14 @@ int main (int argc, char *argv[])
65
66 LINE_BUFFER(stdout); /* Configure stdout buffering */
67
68- while ((opt = getopt(argc, argv, ":nhw:s:p:")) != -1) {
69+ while ((opt = getopt(argc, argv, ":nhVw:s:p:")) != -1) {
70 switch (opt) {
71 case 'h': /* Print usage */
72 usage();
73 return 0;
74+ case 'V':
75+ printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
76+ return 0;
77 case 'w': /* Set CA timeout value */
78 if(epicsScanDouble(optarg, &caTimeout) != 1)
79 {
80diff --git a/src/ca/client/tools/camonitor.c b/src/ca/client/tools/camonitor.c
81index 307dad8..a3fdecd 100644
82--- a/src/ca/client/tools/camonitor.c
83+++ b/src/ca/client/tools/camonitor.c
84@@ -26,6 +26,7 @@
85 #include <stdio.h>
86 #include <epicsStdlib.h>
87 #include <string.h>
88+#include "epicsVersion.h"
89
90 #include <cadef.h>
91 #include <epicsGetopt.h>
92@@ -44,7 +45,8 @@ void usage (void)
93 {
94 fprintf (stderr, "\nUsage: camonitor [options] <PV name> ...\n"
95 "\n"
96- " -h: Help; Print this message\n"
97+ " -h: Help: Print this message\n"
98+ " -V: Version: Show EPICS and CA versions\n"
99 "Channel Access options:\n"
100 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"
101 " -m <msk>: Specify CA event mask to use. <msk> is any combination of\n"
102@@ -209,11 +211,14 @@ int main (int argc, char *argv[])
103
104 LINE_BUFFER(stdout); /* Configure stdout buffering */
105
106- while ((opt = getopt(argc, argv, ":nhm:sSe:f:g:l:#:0:w:t:p:F:")) != -1) {
107+ while ((opt = getopt(argc, argv, ":nhVm:sSe:f:g:l:#:0:w:t:p:F:")) != -1) {
108 switch (opt) {
109 case 'h': /* Print usage */
110 usage();
111 return 0;
112+ case 'V':
113+ printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
114+ return 0;
115 case 'n': /* Print ENUM as index numbers */
116 enumAsNr=1;
117 break;
118diff --git a/src/ca/client/tools/caput.c b/src/ca/client/tools/caput.c
119index 5e4d10e..79ffef8 100644
120--- a/src/ca/client/tools/caput.c
121+++ b/src/ca/client/tools/caput.c
122@@ -37,6 +37,7 @@
123 #include <epicsGetopt.h>
124 #include <epicsEvent.h>
125 #include <epicsString.h>
126+#include "epicsVersion.h"
127
128 #include "tool_lib.h"
129
130@@ -59,6 +60,7 @@ void usage (void)
131 fprintf (stderr, "\nUsage: caput [options] <PV name> <PV value> ...\n"
132 " caput -a [options] <PV name> <no of values> <PV value> ...\n\n"
133 " -h: Help: Print this message\n"
134+ " -V: Version: Show EPICS and CA versions\n"
135 "Channel Access options:\n"
136 " -w <sec>: Wait time, specifies CA timeout, default is %f second(s)\n"
137 " -c: Asynchronous put (use ca_put_callback and wait for completion)\n"
138@@ -281,11 +283,14 @@ int main (int argc, char *argv[])
139 LINE_BUFFER(stdout); /* Configure stdout buffering */
140 putenv("POSIXLY_CORRECT="); /* Behave correct on GNU getopt systems */
141
142- while ((opt = getopt(argc, argv, ":cnlhatsS#:w:p:F:")) != -1) {
143+ while ((opt = getopt(argc, argv, ":cnlhatsVS#:w:p:F:")) != -1) {
144 switch (opt) {
145 case 'h': /* Print usage */
146 usage();
147 return 0;
148+ case 'V':
149+ printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() );
150+ return 0;
151 case 'n': /* Force interpret ENUM as index number */
152 enumAsNr = 1;
153 enumAsString = 0;

Subscribers

People subscribed via source and target branches