tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Relative paths of include files are not normalised, w


From: Fred van Kempen
Subject: Re: [Tinycc-devel] Relative paths of include files are not normalised, which can break #pragma once
Date: Wed, 28 Jun 2023 19:42:25 +0000 (UTC)

As far as I remember (...) pragma acts on a 'module'.  "Handle this module only once."

For most cases, this indeed means a (disk- or memory-based) file.  Pragma's typically
handle only that module, and any modules it includes (#include) or otherwise references.
So,

foo.c
   #pragma once

means "handle this module once", which translates to the entire module and what it
includes.  foo.c, but also anything it includes - the preprocessor typically stops parsing
the file after it detects it already did before.

> Can i pragma once in the middle of my header file?
Yes, but typically, its at the top.

>  Can I pragma once conditionally?
That is a good question, dunno. Sounds a bit weird, but hmmm.

> On linux we can use inode as a proxy, but win32 is lacking inodes… that’s the current
> problem to solve
Windows (well, NTFS) uses file object IDs; either through the MFT or through the API.
Like inodes, they are a per-volume ID (local to the filesystem, so a file module is ID'ed
by (volume ID + file ID.)

For Windows, we can use the

  FileReference

  The 8-byte file reference number for the file. NTFS generates this number and assigns it to the file
  automatically when the file is created.

info, for example.

Retrieving this takes time, but probably less so than doing a full hash on its contents.

Fred


reply via email to

[Prev in Thread] Current Thread [Next in Thread]