Re: [Mesa-dev] [PATCH v2 1/2] [util] add extern "C" guards

2017-02-16 Thread Emil Velikov
On 16 February 2017 at 14:48, Kyriazis, George
<george.kyria...@intel.com> wrote:
>
>> -Original Message-
>> From: ibmir...@gmail.com [mailto:ibmir...@gmail.com] On Behalf Of Ilia
>> Mirkin
>> Sent: Wednesday, February 15, 2017 10:04 PM
>> To: Kyriazis, George <george.kyria...@intel.com>
>> Cc: mesa-dev@lists.freedesktop.org
>> Subject: Re: [Mesa-dev] [PATCH v2 1/2] [util] add extern "C" guards
>>
>> On Wed, Feb 15, 2017 at 10:53 PM, George Kyriazis
>> <george.kyria...@intel.com> wrote:
>> > Added extern "C" __cplusplus guards on headers that did not have them.
>> > ---
>> >  src/gallium/auxiliary/util/u_transfer.h   | 8 
>> >  src/gallium/auxiliary/util/u_upload_mgr.h | 7 +++
>> >  2 files changed, 15 insertions(+)
>> >
>> > diff --git a/src/gallium/auxiliary/util/u_transfer.h
>> > b/src/gallium/auxiliary/util/u_transfer.h
>> > index ab787ab..1408498 100644
>> > --- a/src/gallium/auxiliary/util/u_transfer.h
>> > +++ b/src/gallium/auxiliary/util/u_transfer.h
>> > @@ -10,6 +10,10 @@
>> >  struct pipe_context;
>> >  struct winsys_handle;
>> >
>> > +#ifdef __cplusplus
>> > +extern "C" {
>> > +#endif
>>
>> I'm a little weak on the details, but I wonder if this has to encompass the 
>> type
>> forward decls above. I know that the C extern convention affects function
>> name mangling, but it would stand to reason that it could also affect types.
>> Not sure. e.g. u_blit.h and u_blitter.h include the forward decls inside the
>> extern section.
>>
>
>
> Yes,
>
> I was wondering about that, too, but I followed what was happening in other 
> header files, for example util/u_format.h.
>
> I've seen name mangling affect global vars on MS devenv, but not on gcc, but 
> types seem to work OK on both.
>
Please fix the commit summary - > s|[util]|util/u_format|

Having a forward decl. before the extern C is an exception, so I'd move it.

With the above:
Reviewed-by: Emil Velikov <emil.veli...@collabora.com>

Ilia, nouveau has a few extern C { #include foo } cases. Can you give
them a bash - I'm purging through the rest of mesa.

Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 1/2] [util] add extern "C" guards

2017-02-16 Thread Kyriazis, George

> -Original Message-
> From: ibmir...@gmail.com [mailto:ibmir...@gmail.com] On Behalf Of Ilia
> Mirkin
> Sent: Wednesday, February 15, 2017 10:04 PM
> To: Kyriazis, George <george.kyria...@intel.com>
> Cc: mesa-dev@lists.freedesktop.org
> Subject: Re: [Mesa-dev] [PATCH v2 1/2] [util] add extern "C" guards
> 
> On Wed, Feb 15, 2017 at 10:53 PM, George Kyriazis
> <george.kyria...@intel.com> wrote:
> > Added extern "C" __cplusplus guards on headers that did not have them.
> > ---
> >  src/gallium/auxiliary/util/u_transfer.h   | 8 
> >  src/gallium/auxiliary/util/u_upload_mgr.h | 7 +++
> >  2 files changed, 15 insertions(+)
> >
> > diff --git a/src/gallium/auxiliary/util/u_transfer.h
> > b/src/gallium/auxiliary/util/u_transfer.h
> > index ab787ab..1408498 100644
> > --- a/src/gallium/auxiliary/util/u_transfer.h
> > +++ b/src/gallium/auxiliary/util/u_transfer.h
> > @@ -10,6 +10,10 @@
> >  struct pipe_context;
> >  struct winsys_handle;
> >
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> 
> I'm a little weak on the details, but I wonder if this has to encompass the 
> type
> forward decls above. I know that the C extern convention affects function
> name mangling, but it would stand to reason that it could also affect types.
> Not sure. e.g. u_blit.h and u_blitter.h include the forward decls inside the
> extern section.
> 


Yes,

I was wondering about that, too, but I followed what was happening in other 
header files, for example util/u_format.h.

I've seen name mangling affect global vars on MS devenv, but not on gcc, but 
types seem to work OK on both.


> With that figured out one way or the other, this is
> 
> Reviewed-by: Ilia Mirkin <imir...@alum.mit.edu>
> 
> > +
> >  boolean u_default_resource_get_handle(struct pipe_screen *screen,
> >struct pipe_resource *resource,
> >struct winsys_handle *handle);
> > @@ -95,4 +99,8 @@ void u_transfer_flush_region_vtbl( struct
> > pipe_context *pipe,  void u_transfer_unmap_vtbl( struct pipe_context
> *rm_ctx,
> >  struct pipe_transfer *transfer );
> >
> > +#ifdef __cplusplus
> > +} // extern "C" {
> > +#endif
> > +
> >  #endif
> > diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h
> > b/src/gallium/auxiliary/util/u_upload_mgr.h
> > index 633291e..4538291 100644
> > --- a/src/gallium/auxiliary/util/u_upload_mgr.h
> > +++ b/src/gallium/auxiliary/util/u_upload_mgr.h
> > @@ -38,6 +38,9 @@
> >  struct pipe_context;
> >  struct pipe_resource;
> >
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> >
> >  /**
> >   * Create the upload manager.
> > @@ -109,4 +112,8 @@ void u_upload_data(struct u_upload_mgr *upload,
> > unsigned *out_offset,
> > struct pipe_resource **outbuf);
> >
> > +#ifdef __cplusplus
> > +} // extern "C" {
> > +#endif
> > +
> >  #endif
> > --
> > 2.7.4
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 1/2] [util] add extern "C" guards

2017-02-15 Thread Ilia Mirkin
On Wed, Feb 15, 2017 at 10:53 PM, George Kyriazis
 wrote:
> Added extern "C" __cplusplus guards on headers that did not have them.
> ---
>  src/gallium/auxiliary/util/u_transfer.h   | 8 
>  src/gallium/auxiliary/util/u_upload_mgr.h | 7 +++
>  2 files changed, 15 insertions(+)
>
> diff --git a/src/gallium/auxiliary/util/u_transfer.h 
> b/src/gallium/auxiliary/util/u_transfer.h
> index ab787ab..1408498 100644
> --- a/src/gallium/auxiliary/util/u_transfer.h
> +++ b/src/gallium/auxiliary/util/u_transfer.h
> @@ -10,6 +10,10 @@
>  struct pipe_context;
>  struct winsys_handle;
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif

I'm a little weak on the details, but I wonder if this has to
encompass the type forward decls above. I know that the C extern
convention affects function name mangling, but it would stand to
reason that it could also affect types. Not sure. e.g. u_blit.h and
u_blitter.h include the forward decls inside the extern section.

With that figured out one way or the other, this is

Reviewed-by: Ilia Mirkin 

> +
>  boolean u_default_resource_get_handle(struct pipe_screen *screen,
>struct pipe_resource *resource,
>struct winsys_handle *handle);
> @@ -95,4 +99,8 @@ void u_transfer_flush_region_vtbl( struct pipe_context 
> *pipe,
>  void u_transfer_unmap_vtbl( struct pipe_context *rm_ctx,
>  struct pipe_transfer *transfer );
>
> +#ifdef __cplusplus
> +} // extern "C" {
> +#endif
> +
>  #endif
> diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h 
> b/src/gallium/auxiliary/util/u_upload_mgr.h
> index 633291e..4538291 100644
> --- a/src/gallium/auxiliary/util/u_upload_mgr.h
> +++ b/src/gallium/auxiliary/util/u_upload_mgr.h
> @@ -38,6 +38,9 @@
>  struct pipe_context;
>  struct pipe_resource;
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
>
>  /**
>   * Create the upload manager.
> @@ -109,4 +112,8 @@ void u_upload_data(struct u_upload_mgr *upload,
> unsigned *out_offset,
> struct pipe_resource **outbuf);
>
> +#ifdef __cplusplus
> +} // extern "C" {
> +#endif
> +
>  #endif
> --
> 2.7.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 1/2] [util] add extern "C" guards

2017-02-15 Thread George Kyriazis
Added extern "C" __cplusplus guards on headers that did not have them.
---
 src/gallium/auxiliary/util/u_transfer.h   | 8 
 src/gallium/auxiliary/util/u_upload_mgr.h | 7 +++
 2 files changed, 15 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_transfer.h 
b/src/gallium/auxiliary/util/u_transfer.h
index ab787ab..1408498 100644
--- a/src/gallium/auxiliary/util/u_transfer.h
+++ b/src/gallium/auxiliary/util/u_transfer.h
@@ -10,6 +10,10 @@
 struct pipe_context;
 struct winsys_handle;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 boolean u_default_resource_get_handle(struct pipe_screen *screen,
   struct pipe_resource *resource,
   struct winsys_handle *handle);
@@ -95,4 +99,8 @@ void u_transfer_flush_region_vtbl( struct pipe_context *pipe,
 void u_transfer_unmap_vtbl( struct pipe_context *rm_ctx,
 struct pipe_transfer *transfer );
 
+#ifdef __cplusplus
+} // extern "C" {
+#endif
+
 #endif
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h 
b/src/gallium/auxiliary/util/u_upload_mgr.h
index 633291e..4538291 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.h
+++ b/src/gallium/auxiliary/util/u_upload_mgr.h
@@ -38,6 +38,9 @@
 struct pipe_context;
 struct pipe_resource;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * Create the upload manager.
@@ -109,4 +112,8 @@ void u_upload_data(struct u_upload_mgr *upload,
unsigned *out_offset,
struct pipe_resource **outbuf);
 
+#ifdef __cplusplus
+} // extern "C" {
+#endif
+
 #endif
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev