This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: #define sentinels with __FILE__


On Mon, Dec 4, 2017 at 2:09 PM, Mathieu Malaterre
<mathieu.malaterre@gmail.com> wrote:
> Hi there,
>
> I've always assumed (before #pragma once), that sentinels were written like:
>
> https://en.wikipedia.org/wiki/Include_guard#Use_of_.23include_guards
>
> However grepping the linux source code I see:
>
> $ cat sound/soc/samsung/pcm.h
> #ifndef __S3C_PCM_H
> #define __S3C_PCM_H __FILE__
> <...>
> #endif /* __S3C_PCM_H */
>
> Why would any use:
>
> #define __S3C_PCM_H __FILE__
>
> instead of the simpler:
>
> #define __S3C_PCM_H
>
> This is not a copy/paste error, as I can find other references:
>
> $ grep -r "#define" * | grep "_H " | grep __FILE|wc
>      63     189    4996

Shouldn't you be asking the question in the Linux kernel mailing list
for the definitive answer?

> Thanks,
> --
> Mathieu

--
Best regards,
Tadeus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]