Re: [Mesa-dev] boolean usage in gallium

2019-07-22 Thread Ilia Mirkin
PSA - I've pushed the changes which flip the gallium APIs and their
direct users from boolean -> bool. I've tried to take every precaution
against breaking compilation, but it's conceivable something got
missed in the repository-wide update. However fixing it up should be
trivial - let me know if you should have trouble, I'm happy to help. I
have not updated any of the various drivers' internal usages, and
encourage gallium driver and state tracker maintainers to convert

boolean -> bool
TRUE -> true
FALSE -> false

The one caveat I'll note is that the following situation can occur with boolean:

void f(int x) { print(x); }
void g(boolean x) { f(x); }
void h() { g(123); }

This will print 123, since boolean is a char. With bool, it will print
1. IMHO any code which relies on this behavior is a bug, but bugs do
happen, so a blind conversion can be dangerous.

Cheers,

  -ilia

On Sat, Jun 29, 2019 at 12:08 AM Ilia Mirkin  wrote:
>
> Ken pointed out on IRC today that there was still a lot of "boolean"
> (vs bool/_Bool) usage in gallium. In fact, many interfaces are
> specified with boolean.
>
> I had it in my mind that I had at some point removed most boolean
> usage, but that is just not the case - first of all, the interfaces
> remain with it, and I could find no evidence of such a commit. I must
> have imagined it.
>
> Is there any reason to keep boolean around? I know conversions must be
> done carefully (since incorrect-but-working usage would not currently
> be caught by the compiler), but are there any practical reasons to
> avoid C99 _Bool in gallium code?
>
> If not, I may begin converting things over.
>
> Cheers,
>
>   -ilia
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] boolean usage in gallium

2019-07-03 Thread Erik Faye-Lund
On Sat, 2019-06-29 at 00:08 -0400, Ilia Mirkin wrote:
> Ken pointed out on IRC today that there was still a lot of "boolean"
> (vs bool/_Bool) usage in gallium. In fact, many interfaces are
> specified with boolean.
> 
> I had it in my mind that I had at some point removed most boolean
> usage, but that is just not the case - first of all, the interfaces
> remain with it, and I could find no evidence of such a commit. I must
> have imagined it.
> 
> Is there any reason to keep boolean around? I know conversions must
> be
> done carefully (since incorrect-but-working usage would not currently
> be caught by the compiler), but are there any practical reasons to
> avoid C99 _Bool in gallium code?
> 
> If not, I may begin converting things over.
> 

I would love to see patches for this!

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

Re: [Mesa-dev] boolean usage in gallium

2019-07-01 Thread Jose Fonseca
Yep.  It's better to just use C99 bool everywhere.

Jose

On 30/06/2019 06:00, Marek Olšák wrote:
> boolean predates c99 support in MSVC. I think there is no reason for 
> boolean in gallium now.
> 
> Marek
> 
> On Sat., Jun. 29, 2019, 00:09 Ilia Mirkin,  > wrote:
> 
> Ken pointed out on IRC today that there was still a lot of "boolean"
> (vs bool/_Bool) usage in gallium. In fact, many interfaces are
> specified with boolean.
> 
> I had it in my mind that I had at some point removed most boolean
> usage, but that is just not the case - first of all, the interfaces
> remain with it, and I could find no evidence of such a commit. I must
> have imagined it.
> 
> Is there any reason to keep boolean around? I know conversions must be
> done carefully (since incorrect-but-working usage would not currently
> be caught by the compiler), but are there any practical reasons to
> avoid C99 _Bool in gallium code?
> 
> If not, I may begin converting things over.
> 
> Cheers,
> 
>    -ilia
> ___
> 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://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fmesa-devdata=02%7C01%7Cjfonseca%40vmware.com%7C513e439c4dbe42d80f8808d6fd17f8f1%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C636974676763494464sdata=PudvVZvCoB3oP58vHYwF%2Bq3y14psK3z%2F7PUfayMpidI%3Dreserved=0
> 

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

Re: [Mesa-dev] boolean usage in gallium

2019-06-29 Thread Marek Olšák
boolean predates c99 support in MSVC. I think there is no reason for
boolean in gallium now.

Marek

On Sat., Jun. 29, 2019, 00:09 Ilia Mirkin,  wrote:

> Ken pointed out on IRC today that there was still a lot of "boolean"
> (vs bool/_Bool) usage in gallium. In fact, many interfaces are
> specified with boolean.
>
> I had it in my mind that I had at some point removed most boolean
> usage, but that is just not the case - first of all, the interfaces
> remain with it, and I could find no evidence of such a commit. I must
> have imagined it.
>
> Is there any reason to keep boolean around? I know conversions must be
> done carefully (since incorrect-but-working usage would not currently
> be caught by the compiler), but are there any practical reasons to
> avoid C99 _Bool in gallium code?
>
> If not, I may begin converting things over.
>
> Cheers,
>
>   -ilia
> ___
> 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