linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] lib: Make strreplace prototype compatible with C++
       [not found] <CA+55aFy_whqDaO_qOg0sz8+LKNRfj7QcHVQyce4FvF78tcvTkQ@mail.gmail.com>
@ 2016-06-17 17:24 ` Matt Ullman
  2016-06-17 18:38   ` Randy Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Ullman @ 2016-06-17 17:24 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Matt Ullman

Since "new" is a keyword in C++, this breaks compilation when string.h
is included in a C++ file. For example, this affects VirtualBox Guest
Additions.

https://www.virtualbox.org/pipermail/vbox-dev/2015-August/013368.html

Signed-off-by: Matt Ullman <staticfox@staticfox.net>
---
Thanks for your feedback and I agree. I've made the requested changes.
 include/linux/string.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/string.h b/include/linux/string.h
index 26b6f6a..1e5183b 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -115,7 +115,7 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
 extern void * memchr(const void *,int,__kernel_size_t);
 #endif
 void *memchr_inv(const void *s, int c, size_t n);
-char *strreplace(char *s, char old, char new);
+char *strreplace(char *, char, char);
 
 extern void kfree_const(const void *x);
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] lib: Make strreplace prototype compatible with C++
  2016-06-17 17:24 ` [PATCH v2] lib: Make strreplace prototype compatible with C++ Matt Ullman
@ 2016-06-17 18:38   ` Randy Dunlap
  2016-06-17 19:38     ` Matt Ullman
  0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2016-06-17 18:38 UTC (permalink / raw)
  To: Matt Ullman, Linus Torvalds; +Cc: linux-kernel

On 06/17/16 10:24, Matt Ullman wrote:
> Since "new" is a keyword in C++, this breaks compilation when string.h
> is included in a C++ file. For example, this affects VirtualBox Guest
> Additions.
> 
> https://www.virtualbox.org/pipermail/vbox-dev/2015-August/013368.html
> 
> Signed-off-by: Matt Ullman <staticfox@staticfox.net>
> ---
> Thanks for your feedback and I agree. I've made the requested changes.

I didn't see and could not find any reply to v1.  Who is that comment
addressed to?  Linus?

fwiw, I prefer v1 of the patch.  and so does scripts/kernel-doc.


>  include/linux/string.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/string.h b/include/linux/string.h
> index 26b6f6a..1e5183b 100644
> --- a/include/linux/string.h
> +++ b/include/linux/string.h
> @@ -115,7 +115,7 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
>  extern void * memchr(const void *,int,__kernel_size_t);
>  #endif
>  void *memchr_inv(const void *s, int c, size_t n);
> -char *strreplace(char *s, char old, char new);
> +char *strreplace(char *, char, char);
>  
>  extern void kfree_const(const void *x);
>  
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] lib: Make strreplace prototype compatible with C++
  2016-06-17 18:38   ` Randy Dunlap
@ 2016-06-17 19:38     ` Matt Ullman
  2016-06-17 19:54       ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Ullman @ 2016-06-17 19:38 UTC (permalink / raw)
  To: Randy Dunlap, Linus Torvalds; +Cc: linux-kernel

On Fri, Jun 17, 2016 at 11:38:13AM -0700, Randy Dunlap wrote:
> I didn't see and could not find any reply to v1.  Who is that comment
> addressed to?  Linus?

Yes, this was addressed to Linus. He CC'd the mailing list, but I could not
find it either. Here is what he wrote:

> Please only change the prototype, not the function. Might as well remove
> the argument names in the prototype.
>
> Let's not make the C code uglier for no reason. The fact that C++ screwed
> up and thought that "new" can't be used as a variable name is no reason not
> to do it in C code.
>
> Similarly, we don't make C code use the insane C++ pointer caring rules.
>
>    Linus

-- Matt Ullman

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] lib: Make strreplace prototype compatible with C++
  2016-06-17 19:38     ` Matt Ullman
@ 2016-06-17 19:54       ` Joe Perches
  2016-06-17 20:25         ` Matt Ullman
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2016-06-17 19:54 UTC (permalink / raw)
  To: 57644395.9010505, Randy Dunlap, Linus Torvalds, Matt Ullman; +Cc: linux-kernel

(Matt, you've got an unusual reply-to header)

On Fri, 2016-06-17 at 15:38 -0400, Matt Ullman wrote:
> On Fri, Jun 17, 2016 at 11:38:13AM -0700, Randy Dunlap wrote:
> > I didn't see and could not find any reply to v1.  Who is that comment
> > addressed to?  Linus?
> Yes, this was addressed to Linus. He CC'd the mailing list, but I could not
> find it either. Here is what he wrote:
> > 
> > Please only change the prototype, not the function. Might as well remove
> > the argument names in the prototype.
> > 
> > Let's not make the C code uglier for no reason. The fact that C++ screwed
> > up and thought that "new" can't be used as a variable name is no reason not
> > to do it in C code.
> > 
> > Similarly, we don't make C code use the insane C++ pointer caring rules.
> > 
> >    Linus
> -- Matt Ullman

I think kernel-doc is useful and maybe from/to or find/replace
could be used instead of old/new

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] lib: Make strreplace prototype compatible with C++
  2016-06-17 19:54       ` Joe Perches
@ 2016-06-17 20:25         ` Matt Ullman
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Ullman @ 2016-06-17 20:25 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel

> On Fri, Jun 17, 2016 at 12:54:55PM -0700, Joe Perches wrote:
> (Matt, you've got an unusual reply-to header)

Apologies, I'm using a new mail client and accidently set Reply-To
instead of In-Reply-To.

-- Matt Ullman

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-17 20:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CA+55aFy_whqDaO_qOg0sz8+LKNRfj7QcHVQyce4FvF78tcvTkQ@mail.gmail.com>
2016-06-17 17:24 ` [PATCH v2] lib: Make strreplace prototype compatible with C++ Matt Ullman
2016-06-17 18:38   ` Randy Dunlap
2016-06-17 19:38     ` Matt Ullman
2016-06-17 19:54       ` Joe Perches
2016-06-17 20:25         ` Matt Ullman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).