tgsi: include struct definitions for tgsi_build declarations

Submitted by Rob Herring on Jan. 8, 2018, 9:18 p.m.

Details

Message ID 20180108211828.32623-1-robh@kernel.org
State New
Headers show
Series "tgsi: include struct definitions for tgsi_build declarations" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Rob Herring Jan. 8, 2018, 9:18 p.m.
Many of the functions declared in tgsi_build.h return structs (not struct
pointers). Therefore the full struct definitions are needed to avoid
warnings or errors:

In file included from src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp:23:
external/mesa3d/src/gallium/auxiliary/tgsi/tgsi_build.h:47:1: error: 'tgsi_build_header' has C-linkage specified, but returns incomplete type 'struct tgsi_header' which could be incompatible with C [-Werror,-Wreturn-type-c-linkage]

This error shows up on Android builds using clang and -Werror.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 src/gallium/auxiliary/tgsi/tgsi_build.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h
index 53f31932c021..053292957211 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.h
@@ -28,11 +28,7 @@ 
 #ifndef TGSI_BUILD_H
 #define TGSI_BUILD_H
 
-
-struct tgsi_token;
-struct tgsi_full_dst_register;
-struct tgsi_full_src_register;
-
+#include <tgsi/tgsi_parse.h>
 
 #if defined __cplusplus
 extern "C" {

Comments

On Mon, Jan 8, 2018 at 4:18 PM, Rob Herring <robh@kernel.org> wrote:
> Many of the functions declared in tgsi_build.h return structs (not struct
> pointers). Therefore the full struct definitions are needed to avoid
> warnings or errors:
>
> In file included from src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp:23:
> external/mesa3d/src/gallium/auxiliary/tgsi/tgsi_build.h:47:1: error: 'tgsi_build_header' has C-linkage specified, but returns incomplete type 'struct tgsi_header' which could be incompatible with C [-Werror,-Wreturn-type-c-linkage]

Ah, looks like this is real, and a result of my recent bindless image
changes. When your bot emailed me I assumed it was fake, as it had
sent previous false positives. Sorry about that.

Arguably the tgsi_parse.h should be included in from_tgsi.cpp - not
sure, since I also make use of struct tgsi_full_src_register. But
files including what they need is good too. I'm open to either
solution.

>
> This error shows up on Android builds using clang and -Werror.
>
> Cc: Ilia Mirkin <imirkin@alum.mit.edu>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  src/gallium/auxiliary/tgsi/tgsi_build.h | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h
> index 53f31932c021..053292957211 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_build.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_build.h
> @@ -28,11 +28,7 @@
>  #ifndef TGSI_BUILD_H
>  #define TGSI_BUILD_H
>
> -
> -struct tgsi_token;
> -struct tgsi_full_dst_register;
> -struct tgsi_full_src_register;
> -
> +#include <tgsi/tgsi_parse.h>

We use "tgsi/tgsi_parse.h" everywhere.

>
>  #if defined __cplusplus
>  extern "C" {
> --
> 2.14.1
>
On Mon, Jan 8, 2018 at 7:25 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> On Mon, Jan 8, 2018 at 4:18 PM, Rob Herring <robh@kernel.org> wrote:
>> Many of the functions declared in tgsi_build.h return structs (not struct
>> pointers). Therefore the full struct definitions are needed to avoid
>> warnings or errors:
>>
>> In file included from src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp:23:
>> external/mesa3d/src/gallium/auxiliary/tgsi/tgsi_build.h:47:1: error: 'tgsi_build_header' has C-linkage specified, but returns incomplete type 'struct tgsi_header' which could be incompatible with C [-Werror,-Wreturn-type-c-linkage]
>
> Ah, looks like this is real, and a result of my recent bindless image
> changes. When your bot emailed me I assumed it was fake, as it had
> sent previous false positives. Sorry about that.

Yeah, it's not as stable as I'd like...

> Arguably the tgsi_parse.h should be included in from_tgsi.cpp - not
> sure, since I also make use of struct tgsi_full_src_register. But
> files including what they need is good too. I'm open to either
> solution.

Following the latter, it probably should be included in both then.

>> This error shows up on Android builds using clang and -Werror.
>>
>> Cc: Ilia Mirkin <imirkin@alum.mit.edu>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> ---
>>  src/gallium/auxiliary/tgsi/tgsi_build.h | 6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h
>> index 53f31932c021..053292957211 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_build.h
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_build.h
>> @@ -28,11 +28,7 @@
>>  #ifndef TGSI_BUILD_H
>>  #define TGSI_BUILD_H
>>
>> -
>> -struct tgsi_token;
>> -struct tgsi_full_dst_register;
>> -struct tgsi_full_src_register;
>> -
>> +#include <tgsi/tgsi_parse.h>
>
> We use "tgsi/tgsi_parse.h" everywhere.

Okay.