Merge ~bhill/epics-base:EPICS-and-CA-version-from-CA-tools into ~epics-core/epics-base/+git/epics-base:3.15
- Git
- lp:~bhill/epics-base
- EPICS-and-CA-version-from-CA-tools
- Merge into 3.15
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) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
mdavidsaver | Approve | ||
Andrew Johnson | Approve | ||
Review via email: mp+358142@code.launchpad.net |
Commit message
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.
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?
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/
+++ b/configure/
@@ -186,6 +186,12 @@ VXCPPFLAGS = $(filter-out $(OP_SYS_
PREPROCESS.cpp = $(CPP) $(VXCPPFLAGS) $(INCLUDES) $< > $@
#-----
+# Don't use gcc 2.x for dependency generation
+
+HDEPENDS_METHOD_2 = MKMF
+HDEPENDS_METHOD = $(firstword $(HDEPENDS_
+
+#-----
# Allow site overrides
-include $(CONFIG)
-include $(CONFIG)
- Andrew
Bruce Hill (bhill) wrote : | # |
You're right. Old habits die hard.
mdavidsaver (mdavidsaver) wrote : | # |
Looks fine now.
Preview Diff
1 | diff --git a/src/ca/client/tools/caget.c b/src/ca/client/tools/caget.c | |||
2 | index 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 | 34 | #include <alarm.h> | 34 | #include <alarm.h> |
7 | 35 | #include <cadef.h> | 35 | #include <cadef.h> |
8 | 36 | #include <epicsGetopt.h> | 36 | #include <epicsGetopt.h> |
9 | 37 | #include "epicsVersion.h" | ||
10 | 37 | 38 | ||
11 | 38 | #include "tool_lib.h" | 39 | #include "tool_lib.h" |
12 | 39 | 40 | ||
13 | @@ -55,6 +56,7 @@ static void usage (void) | |||
14 | 55 | { | 56 | { |
15 | 56 | fprintf (stderr, "\nUsage: caget [options] <PV name> ...\n\n" | 57 | fprintf (stderr, "\nUsage: caget [options] <PV name> ...\n\n" |
16 | 57 | " -h: Help: Print this message\n" | 58 | " -h: Help: Print this message\n" |
17 | 59 | " -V: Version: Show EPICS and CA versions\n" | ||
18 | 58 | "Channel Access options:\n" | 60 | "Channel Access options:\n" |
19 | 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" |
20 | 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" |
21 | @@ -389,11 +391,14 @@ int main (int argc, char *argv[]) | |||
22 | 389 | 391 | ||
23 | 390 | LINE_BUFFER(stdout); /* Configure stdout buffering */ | 392 | LINE_BUFFER(stdout); /* Configure stdout buffering */ |
24 | 391 | 393 | ||
26 | 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) { |
27 | 393 | switch (opt) { | 395 | switch (opt) { |
28 | 394 | case 'h': /* Print usage */ | 396 | case 'h': /* Print usage */ |
29 | 395 | usage(); | 397 | usage(); |
30 | 396 | return 0; | 398 | return 0; |
31 | 399 | case 'V': | ||
32 | 400 | printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() ); | ||
33 | 401 | return 0; | ||
34 | 397 | case 't': /* Terse output mode */ | 402 | case 't': /* Terse output mode */ |
35 | 398 | complainIfNotPlainAndSet(&format, terse); | 403 | complainIfNotPlainAndSet(&format, terse); |
36 | 399 | break; | 404 | break; |
37 | diff --git a/src/ca/client/tools/cainfo.c b/src/ca/client/tools/cainfo.c | |||
38 | index 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 | 23 | 23 | ||
43 | 24 | #include <stdio.h> | 24 | #include <stdio.h> |
44 | 25 | #include <epicsStdlib.h> | 25 | #include <epicsStdlib.h> |
45 | 26 | #include "epicsVersion.h" | ||
46 | 26 | 27 | ||
47 | 27 | #include <cadef.h> | 28 | #include <cadef.h> |
48 | 28 | #include <epicsGetopt.h> | 29 | #include <epicsGetopt.h> |
49 | @@ -36,12 +37,14 @@ void usage (void) | |||
50 | 36 | { | 37 | { |
51 | 37 | fprintf (stderr, "\nUsage: cainfo [options] <PV name> ...\n\n" | 38 | fprintf (stderr, "\nUsage: cainfo [options] <PV name> ...\n\n" |
52 | 38 | " -h: Help: Print this message\n" | 39 | " -h: Help: Print this message\n" |
53 | 40 | " -V: Version: Show EPICS and CA versions\n" | ||
54 | 39 | "Channel Access options:\n" | 41 | "Channel Access options:\n" |
55 | 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" |
56 | 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" |
57 | 42 | " -p <prio>: CA priority (0-%u, default 0=lowest)\n" | 44 | " -p <prio>: CA priority (0-%u, default 0=lowest)\n" |
58 | 43 | "\nExample: cainfo my_channel another_channel\n\n" | 45 | "\nExample: cainfo my_channel another_channel\n\n" |
59 | 44 | , DEFAULT_TIMEOUT, CA_PRIORITY_MAX); | 46 | , DEFAULT_TIMEOUT, CA_PRIORITY_MAX); |
60 | 47 | fprintf (stderr, "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() ); | ||
61 | 45 | } | 48 | } |
62 | 46 | 49 | ||
63 | 47 | 50 | ||
64 | @@ -137,11 +140,14 @@ int main (int argc, char *argv[]) | |||
65 | 137 | 140 | ||
66 | 138 | LINE_BUFFER(stdout); /* Configure stdout buffering */ | 141 | LINE_BUFFER(stdout); /* Configure stdout buffering */ |
67 | 139 | 142 | ||
69 | 140 | while ((opt = getopt(argc, argv, ":nhw:s:p:")) != -1) { | 143 | while ((opt = getopt(argc, argv, ":nhVw:s:p:")) != -1) { |
70 | 141 | switch (opt) { | 144 | switch (opt) { |
71 | 142 | case 'h': /* Print usage */ | 145 | case 'h': /* Print usage */ |
72 | 143 | usage(); | 146 | usage(); |
73 | 144 | return 0; | 147 | return 0; |
74 | 148 | case 'V': | ||
75 | 149 | printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() ); | ||
76 | 150 | return 0; | ||
77 | 145 | case 'w': /* Set CA timeout value */ | 151 | case 'w': /* Set CA timeout value */ |
78 | 146 | if(epicsScanDouble(optarg, &caTimeout) != 1) | 152 | if(epicsScanDouble(optarg, &caTimeout) != 1) |
79 | 147 | { | 153 | { |
80 | diff --git a/src/ca/client/tools/camonitor.c b/src/ca/client/tools/camonitor.c | |||
81 | index 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 | 26 | #include <stdio.h> | 26 | #include <stdio.h> |
86 | 27 | #include <epicsStdlib.h> | 27 | #include <epicsStdlib.h> |
87 | 28 | #include <string.h> | 28 | #include <string.h> |
88 | 29 | #include "epicsVersion.h" | ||
89 | 29 | 30 | ||
90 | 30 | #include <cadef.h> | 31 | #include <cadef.h> |
91 | 31 | #include <epicsGetopt.h> | 32 | #include <epicsGetopt.h> |
92 | @@ -44,7 +45,8 @@ void usage (void) | |||
93 | 44 | { | 45 | { |
94 | 45 | fprintf (stderr, "\nUsage: camonitor [options] <PV name> ...\n" | 46 | fprintf (stderr, "\nUsage: camonitor [options] <PV name> ...\n" |
95 | 46 | "\n" | 47 | "\n" |
97 | 47 | " -h: Help; Print this message\n" | 48 | " -h: Help: Print this message\n" |
98 | 49 | " -V: Version: Show EPICS and CA versions\n" | ||
99 | 48 | "Channel Access options:\n" | 50 | "Channel Access options:\n" |
100 | 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" |
101 | 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" |
102 | @@ -209,11 +211,14 @@ int main (int argc, char *argv[]) | |||
103 | 209 | 211 | ||
104 | 210 | LINE_BUFFER(stdout); /* Configure stdout buffering */ | 212 | LINE_BUFFER(stdout); /* Configure stdout buffering */ |
105 | 211 | 213 | ||
107 | 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) { |
108 | 213 | switch (opt) { | 215 | switch (opt) { |
109 | 214 | case 'h': /* Print usage */ | 216 | case 'h': /* Print usage */ |
110 | 215 | usage(); | 217 | usage(); |
111 | 216 | return 0; | 218 | return 0; |
112 | 219 | case 'V': | ||
113 | 220 | printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() ); | ||
114 | 221 | return 0; | ||
115 | 217 | case 'n': /* Print ENUM as index numbers */ | 222 | case 'n': /* Print ENUM as index numbers */ |
116 | 218 | enumAsNr=1; | 223 | enumAsNr=1; |
117 | 219 | break; | 224 | break; |
118 | diff --git a/src/ca/client/tools/caput.c b/src/ca/client/tools/caput.c | |||
119 | index 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 | 37 | #include <epicsGetopt.h> | 37 | #include <epicsGetopt.h> |
124 | 38 | #include <epicsEvent.h> | 38 | #include <epicsEvent.h> |
125 | 39 | #include <epicsString.h> | 39 | #include <epicsString.h> |
126 | 40 | #include "epicsVersion.h" | ||
127 | 40 | 41 | ||
128 | 41 | #include "tool_lib.h" | 42 | #include "tool_lib.h" |
129 | 42 | 43 | ||
130 | @@ -59,6 +60,7 @@ void usage (void) | |||
131 | 59 | fprintf (stderr, "\nUsage: caput [options] <PV name> <PV value> ...\n" | 60 | fprintf (stderr, "\nUsage: caput [options] <PV name> <PV value> ...\n" |
132 | 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" |
133 | 61 | " -h: Help: Print this message\n" | 62 | " -h: Help: Print this message\n" |
134 | 63 | " -V: Version: Show EPICS and CA versions\n" | ||
135 | 62 | "Channel Access options:\n" | 64 | "Channel Access options:\n" |
136 | 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" |
137 | 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" |
138 | @@ -281,11 +283,14 @@ int main (int argc, char *argv[]) | |||
139 | 281 | LINE_BUFFER(stdout); /* Configure stdout buffering */ | 283 | LINE_BUFFER(stdout); /* Configure stdout buffering */ |
140 | 282 | putenv("POSIXLY_CORRECT="); /* Behave correct on GNU getopt systems */ | 284 | putenv("POSIXLY_CORRECT="); /* Behave correct on GNU getopt systems */ |
141 | 283 | 285 | ||
143 | 284 | while ((opt = getopt(argc, argv, ":cnlhatsS#:w:p:F:")) != -1) { | 286 | while ((opt = getopt(argc, argv, ":cnlhatsVS#:w:p:F:")) != -1) { |
144 | 285 | switch (opt) { | 287 | switch (opt) { |
145 | 286 | case 'h': /* Print usage */ | 288 | case 'h': /* Print usage */ |
146 | 287 | usage(); | 289 | usage(); |
147 | 288 | return 0; | 290 | return 0; |
148 | 291 | case 'V': | ||
149 | 292 | printf( "\nEPICS Version %s, CA Protocol version %s\n", EPICS_VERSION_STRING, ca_version() ); | ||
150 | 293 | return 0; | ||
151 | 289 | case 'n': /* Force interpret ENUM as index number */ | 294 | case 'n': /* Force interpret ENUM as index number */ |
152 | 290 | enumAsNr = 1; | 295 | enumAsNr = 1; |
153 | 291 | enumAsString = 0; | 296 | enumAsString = 0; |
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.