Re: [libvirt] [PATCH v2 2/2] Added syntax-check rule for return with parentheses

2012-03-26 Thread Martin Kletzander
On 03/26/2012 05:43 AM, Osier Yang wrote:
 On 2012年03月23日 15:34, Martin Kletzander wrote:
 After cleanup introduced with previous commit, there is a need for
 syntax-check rule taking care of return(). Regexp used in 'prohibit'
 parameter is taken from the cleanup commit and modified so it fits
 'grep -E' format. Semicolon at the end is needed, otherwise the regexp
 could match return with cast.

 Exception is created for python source files because we don't have any
 documentation restricting the use of return that matches this case.
 ---
   cfg.mk |8 
   1 files changed, 8 insertions(+), 0 deletions(-)

 diff --git a/cfg.mk b/cfg.mk
 index 24e6a69..eae629b 100644
 --- a/cfg.mk
 +++ b/cfg.mk
 @@ -469,6 +469,12 @@ sc_prohibit_xmlURI:
   halt='use virURI(Parse|Format), not xml(ParseURI|SaveUri)'\
 $(_sc_search_regexp)

 +# we don't want old old-style return with parentheses around argument
 +sc_prohibit_return_as_function:
 +@prohibit='\return *\(([^()]*(\([^()]*\)[^()]*)*)\) *;'\
 +halt='avoid extra () with return statements'\
 +  $(_sc_search_regexp)
 +
   # ATTRIBUTE_UNUSED should only be applied in implementations, not
   # header declarations
   sc_avoid_attribute_unused_in_header:
 @@ -791,6 +797,8 @@ exclude_file_name_regexp--sc_prohibit_xmlGetProp =
 ^src/util/xml\.c$$

   exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$

 +exclude_file_name_regexp--sc_prohibit_return_as_function = ^\.py$$
 +
   exclude_file_name_regexp--sc_require_config_h = ^examples/

   exclude_file_name_regexp--sc_require_config_h_first = ^examples/
 -- 
 1.7.3.4
 
 Looks good from my point of view, ACK. But we might need to
 push these later after 0.9.11.
 
 Regards,
 Osier
 

We've totally missed the '^' in the exception, that shouldn't be there,
so either please fix this before pushing it or send me NACK or ping me
on IRC so I know if I should send fixed version, thanks and sorry for
the trouble.

Martin

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2 2/2] Added syntax-check rule for return with parentheses

2012-03-26 Thread Eric Blake
On 03/26/2012 03:48 AM, Martin Kletzander wrote:
 On 03/26/2012 05:43 AM, Osier Yang wrote:
 On 2012年03月23日 15:34, Martin Kletzander wrote:
 After cleanup introduced with previous commit, there is a need for
 syntax-check rule taking care of return(). Regexp used in 'prohibit'
 parameter is taken from the cleanup commit and modified so it fits
 'grep -E' format. Semicolon at the end is needed, otherwise the regexp
 could match return with cast.



 Looks good from my point of view, ACK. But we might need to
 push these later after 0.9.11.

I see no problem with going for it now, as it is supposed to be no
semantic change; and the longer we wait, the more likely it is to have
conflicts when we rebase it later.

 We've totally missed the '^' in the exception, that shouldn't be there,
 so either please fix this before pushing it or send me NACK or ping me
 on IRC so I know if I should send fixed version, thanks and sorry for
 the trouble.

I fixed that up, and pushed the series.

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2 2/2] Added syntax-check rule for return with parentheses

2012-03-25 Thread Osier Yang

On 2012年03月23日 15:34, Martin Kletzander wrote:

After cleanup introduced with previous commit, there is a need for
syntax-check rule taking care of return(). Regexp used in 'prohibit'
parameter is taken from the cleanup commit and modified so it fits
'grep -E' format. Semicolon at the end is needed, otherwise the regexp
could match return with cast.

Exception is created for python source files because we don't have any
documentation restricting the use of return that matches this case.
---
  cfg.mk |8 
  1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 24e6a69..eae629b 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -469,6 +469,12 @@ sc_prohibit_xmlURI:
halt='use virURI(Parse|Format), not xml(ParseURI|SaveUri)'  \
  $(_sc_search_regexp)

+# we don't want old old-style return with parentheses around argument
+sc_prohibit_return_as_function:
+   @prohibit='\return *\(([^()]*(\([^()]*\)[^()]*)*)\) *;'\
+   halt='avoid extra () with return statements'\
+ $(_sc_search_regexp)
+
  # ATTRIBUTE_UNUSED should only be applied in implementations, not
  # header declarations
  sc_avoid_attribute_unused_in_header:
@@ -791,6 +797,8 @@ exclude_file_name_regexp--sc_prohibit_xmlGetProp = 
^src/util/xml\.c$$

  exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$

+exclude_file_name_regexp--sc_prohibit_return_as_function = ^\.py$$
+
  exclude_file_name_regexp--sc_require_config_h = ^examples/

  exclude_file_name_regexp--sc_require_config_h_first = ^examples/
--
1.7.3.4


Looks good from my point of view, ACK. But we might need to
push these later after 0.9.11.

Regards,
Osier

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v2 2/2] Added syntax-check rule for return with parentheses

2012-03-23 Thread Martin Kletzander
After cleanup introduced with previous commit, there is a need for
syntax-check rule taking care of return(). Regexp used in 'prohibit'
parameter is taken from the cleanup commit and modified so it fits
'grep -E' format. Semicolon at the end is needed, otherwise the regexp
could match return with cast.

Exception is created for python source files because we don't have any
documentation restricting the use of return that matches this case.
---
 cfg.mk |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 24e6a69..eae629b 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -469,6 +469,12 @@ sc_prohibit_xmlURI:
halt='use virURI(Parse|Format), not xml(ParseURI|SaveUri)'  \
  $(_sc_search_regexp)

+# we don't want old old-style return with parentheses around argument
+sc_prohibit_return_as_function:
+   @prohibit='\return *\(([^()]*(\([^()]*\)[^()]*)*)\) *;'\
+   halt='avoid extra () with return statements'\
+ $(_sc_search_regexp)
+
 # ATTRIBUTE_UNUSED should only be applied in implementations, not
 # header declarations
 sc_avoid_attribute_unused_in_header:
@@ -791,6 +797,8 @@ exclude_file_name_regexp--sc_prohibit_xmlGetProp = 
^src/util/xml\.c$$

 exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$

+exclude_file_name_regexp--sc_prohibit_return_as_function = ^\.py$$
+
 exclude_file_name_regexp--sc_require_config_h = ^examples/

 exclude_file_name_regexp--sc_require_config_h_first = ^examples/
--
1.7.3.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list