Re: [net-snmp:code] treewide: Terminate netsnmp_feature_*() uses with a semicolon

Bill Fenner via Net-snmp-coders <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <CAF4SogbpEOX_FNf+H+ACaxdQj+sYqwpVZ9frKtUV6+K=70hFRw@mail.gmail.com>
On Mon, Aug 26, 2019 at 12:34 PM Bill Fenner <[email protected]>
wrote:

> On Mon, Aug 26, 2019 at 11:48 AM Bill Fenner <[email protected]>
> wrote:
>
>> On Tue, Aug 13, 2019 at 11:17 PM net-snmp Git repository <
>> [email protected]> wrote:
>>
>>> Branch: V5-8-patches
>>>
>>> treewide: Terminate netsnmp_feature_*() uses with a semicolon
>>>
>>> This patch has been generated by the following shell command:
>>>
>>> git grep -l netsnmp_feature_ |
>>> while read f; do sed -i 's/^netsnmp_feature.*[^;]$/&;/' "$f"; done
>>>
>>> By Bart Van Assche on 08/14/2019 02:58
>>>
>>
>> Hi Bart,
>>
>> Thank you very much for all the cleanups you've been working on
>> recently.  I really appreciate it.
>>
>> Have you tried using features with this change?  I am getting errors like:
>>
>> [net-snmp] In file included from
>> *../include/net-snmp/net-snmp-features.h:11:0*,
>>
>> [net-snmp]                  from *snmp_client.c:48*:
>>
>> [net-snmp] *../include/net-snmp/agent/features.h:4:39:* *error: *ISO C99
>> requires whitespace after the macro name [*-Werror*]
>>
>> [net-snmp]  #define NETSNMP_FEATURE_HAS_BABY_STEPS*;* 1
>>
>> [net-snmp]                                        *^*
>>
>> which appear likely to be due to the feature calculation infrastructure
>> not understanding these semicolons.  The semicolon seems to be making it
>> into the .ft file for *some* macros but not others:
>>
>> ./agent/helpers/baby_steps.ft:#define NETSNMP_FEATURE_PROVIDE_
>> *BABY_STEPS*; 1
>>
>> ./agent/helpers/baby_steps.ft:#define NETSNMP_FEATURE_*BABY_STEPS*_CHILD_OF_MIB_HELPERS;
>> 1
>>
>> ./agent/helpers/baby_steps.ft:#define NETSNMP_FEATURE_PROVIDE_
>> *BABY_STEPS* 1
>>
>> ./agent/helpers/baby_steps.ft:#define NETSNMP_FEATURE_NETSNMP_
>> *BABY_STEPS*_HANDLER_INIT_CHILD_OF_NETSNMP_UNUSED; 1
>>
>> ./agent/helpers/baby_steps.ft:#define NETSNMP_FEATURE_PROVIDE_NETSNMP_
>> *BABY_STEPS*_HANDLER_INIT 1
>>
>> I'm happy to dig into this, but wanted to see if you had seen it
>> already.  (Not asking for a revert; let's move this forward together)
>>
>> Looks like these diffs in local/minimalist/feature-check fix it:
>
> -for i in `grep NSF_RR $tmpf | sed 's/ NSF_RR//'` ; do
>
> +for i in `grep NSF_RR $tmpf | sed 's/ NSF_RR;//'` ; do
>
> -for i in `grep NSF_PP $tmpf | sed 's/ NSF_PP//'` ; do
>
> +for i in `grep NSF_PP $tmpf | sed 's/ NSF_PP;//'` ; do
>
> -for i in `grep NSF_CO $tmpf | sed 's/ NSF_CO//'` ; do
>
> +for i in `grep NSF_CO $tmpf | sed 's/ NSF_CO;//'` ; do
>
> -for i in `grep NSF_WW $tmpf | sed 's/ NSF_WW//'` ; do
>
> +for i in `grep NSF_WW $tmpf | sed 's/ NSF_WW;//'` ; do
>
> I'll do some more testing and check it in.
>

Just as a personal preference, I like to use "awk" instead of grep|... -
"awk '/NSF_WW/ {print $1}' $tmpf" gives the same result and doesn't care
about the presence or absence of the semicolon - but, I don't know about
Windows: if grep and sed are available, is awk?

Thanks,
  Bill

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.