[Mesa-dev] [PATCH 08/10] mesa: trim down #includes in compiler.h

Brian Paul brianp at vmware.com
Thu Feb 26 10:01:45 PST 2015


On 02/26/2015 10:32 AM, Matt Turner wrote:
> On Thu, Feb 26, 2015 at 7:34 AM, Brian Paul <brianp at vmware.com> wrote:
>> On 02/25/2015 08:36 PM, Matt Turner wrote:
>>>
>>> On Wed, Feb 25, 2015 at 5:30 PM, Brian Paul <brianp at vmware.com> wrote:
>>>>
>>>> Don't include stuff we don't need.  Fix a few #includes elsewhere to
>>>> keep thing building.
>>>> ---
>>>>    src/mesa/main/compiler.h                 | 3 ---
>>>>    src/mesa/main/cpuinfo.c                  | 2 +-
>>>>    src/mesa/main/imports.h                  | 2 ++
>>>>    src/mesa/program/prog_parameter_layout.c | 2 +-
>>>>    4 files changed, 4 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
>>>> index 12c02b2..a700ff9 100644
>>>> --- a/src/mesa/main/compiler.h
>>>> +++ b/src/mesa/main/compiler.h
>>>> @@ -36,9 +36,6 @@
>>>>
>>>>    #include <assert.h>
>>>>    #include <math.h>
>>>> -#include <stdlib.h>
>>>> -#include <stdio.h>
>>>> -#include <string.h>
>>>>
>>>>    #include "util/macros.h"
>>>>
>>>> diff --git a/src/mesa/main/cpuinfo.c b/src/mesa/main/cpuinfo.c
>>>> index 0755d6b..67f22ab 100644
>>>> --- a/src/mesa/main/cpuinfo.c
>>>> +++ b/src/mesa/main/cpuinfo.c
>>>> @@ -23,7 +23,7 @@
>>>>     */
>>>>
>>>>
>>>> -#include "main/compiler.h"
>>>> +#include "main/imports.h"
>>>
>>>
>>> Including imports.h seems strange, since it wasn't including it, even
>>> indirectly, before. Is imports.h really right?
>>>
>>>>    #include "main/cpuinfo.h"
>>>>
>>>>
>>>> diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
>>>> index d886427..2af45a3 100644
>>>> --- a/src/mesa/main/imports.h
>>>> +++ b/src/mesa/main/imports.h
>>>> @@ -36,6 +36,8 @@
>>>>    #define IMPORTS_H
>>>>
>>>>
>>>> +#include <stdlib.h>
>>>> +#include <string.h>
>>>>    #include "compiler.h"
>>>>    #include "glheader.h"
>>>>    #include "errors.h"
>>>> diff --git a/src/mesa/program/prog_parameter_layout.c
>>>> b/src/mesa/program/prog_parameter_layout.c
>>>> index e834690..282a367 100644
>>>> --- a/src/mesa/program/prog_parameter_layout.c
>>>> +++ b/src/mesa/program/prog_parameter_layout.c
>>>> @@ -28,7 +28,7 @@
>>>>     * \author Ian Romanick <ian.d.romanick at intel.com>
>>>>     */
>>>>
>>>> -#include "main/compiler.h"
>>>> +#include "main/imports.h"
>>>
>>>
>>> Same thing here.
>>>
>>
>> Those files use functions like strlen(), malloc(), free(), etc, which no
>> longer get pulled in by compiler.h
>
> I guess my question is whether we need imports.h or whether we can
> simply include stdlib.h, string.h, and friends directly?

I guess I don't feel too strongly about it.

Getting them from imports.h goes back to when we had MALLOC/FREE/etc 
wrappers so it's a dated convention.

I think moving away from imports.h would probably be good.  It kind of 
became a dumping ground for all kinds of odds and ends.  I'm picking 
away at cleaning it up between other things...

-Brian



More information about the mesa-dev mailing list