[Mesa-dev] [PATCH 02/10] nir: add NIR_H include guard

Connor Abbott cwabbott0 at gmail.com
Wed Oct 7 06:15:12 PDT 2015


On Wed, Oct 7, 2015 at 7:59 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 7 October 2015 at 12:27, Boyan Ding <boyan.j.ding at gmail.com> wrote:
>> 2015-10-07 18:11 GMT+08:00 Emil Velikov <emil.l.velikov at gmail.com>:
>>> We will reuse it in later commits, to check if other headers are
>>> included from within nir.h.
>>>
>>> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
>>> ---
>>>  src/glsl/nir/nir.h | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
>>> index bde9f49..b017be2 100644
>>> --- a/src/glsl/nir/nir.h
>>> +++ b/src/glsl/nir/nir.h
>>> @@ -26,6 +26,8 @@
>>>   */
>>>
>>>  #pragma once
>>> +#ifndef NIR_H
>>> +#define NIR_H
>>
>> The '#pragma once' above will become redundant after the #ifdef compile
>> guard is added. No idea whether it should be removed, though.
>>
> Indeed it would. There was a discussion a while back on the topic
> pragma once and/or ifndef [1]. Don't think we ever reached a consensus
> though. I can drop the pragma, If there are no objections.
>
> Thanks for bringing this up :)
> Emil
>
> [1] http://lists.freedesktop.org/archives/mesa-dev/2013-September/045377.html

I think the consensus there was "we need the define because of silly
compilers, but the pragma still makes stuff faster with GCC because it
can stop parsing the file immediately instead of having to read till
the closing #endif".

> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list