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


On 20.09.2023 0:04, Paul Eggert wrote:
On 2023-09-19 01:52, Sébastien Hinderer wrote:
Are you saying that there should normally not  be any
undef in the config headers for macros whose name starts with a _ sign?

No, it's normal when Autoconf is used as intended. What's not normal is that your package is including <config.h> after including standard headers.

Since macro names starting with "_" can affect how standard headers behave, these macro definitions need to be done before including any standard headers, and this is partly why <config.h> should be included first.

Although _FILE_OFFSET_BITS is one example of such a macro (so you'll need to set it using "gcc -D" or equivalent), there are likely many other examples and they all need to be treated similarly.

I'd also recommend to avoid using any types from standard headers if their interpretation depends on predefined macros, like 'off_t'. You cannot grantee that macros will be defined in the same way when your header is included by third-party apps. Use only "stable" types, like 'uint64_t'. If you need have a function with "file offset" argument then use either 'uint64_t' (if the offset if always from the start of the file) or 'int64_t' (if the offset is relative to current position). Them handle in you code situations when system 'off_t' is 32-bit wide and application requested more than UINT32_MAX offset.

Your "config.h" must not be used in your public header as it will create various problems.

If you cannot include "config.h" before the system headers in your application/library, then another workaround is excluding of AC_CONFIG_HEADERS from "". In such case all definitions will be in @DEFS@ that could be used in CPPFLAGS (or used directly by libtool as $(DEFS)), therefore all macros will be defined always, before including system headers.


Attachment: OpenPGP_0x460A317C3326D2AE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux