Opened 13 years ago

Closed 5 years ago

#4282 closed enhancement (wontfix)

Prevent redefinitions in cpl_config.h

Reported by: fwobbe Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: default Version: svn-trunk
Severity: normal Keywords: cpl_config.h
Cc:

Description

Hi, the #undef statements in the header template file 'port/cpl_config.h.in' are not wrapped in #ifndef ... #endif conditions. The problem with this is that e.g. HAVE_UNISTD_H and HAVE_UNISTD_H are standard symbol names generated by autoconf (AC_CHECK_HEADERS). This can cause unwanted redefinition of the symbols, when gdal.h is included in projects that also use autoconf. To resolve this issue I suggest to apply the attached patch to trunk. Cheers.

Attachments (1)

cpl_config.h.in.patch (7.6 KB ) - added by fwobbe 13 years ago.

Download all attachments as: .zip

Change History (9)

by fwobbe, 13 years ago

Attachment: cpl_config.h.in.patch added

comment:1 by fwobbe, 13 years ago

Version: unspecifiedsvn-trunk

comment:2 by Even Rouault, 13 years ago

I don't believe this is the right approach. We shouldn't have to mess up with that file. The main problem is that we should follow the common practice that wants that cpl_config.h should not be included by public GDAL headers to start with, but this might require quite a bit of code change to move its inclusion from cpl_port.h (which seems to be the only includer at first sight, but cpl_port.h is dragged by everybody) into all needed places.

in reply to:  2 comment:3 by fwobbe, 13 years ago

Replying to rouault:

[...] The main problem is that we should follow the common practice that wants that cpl_config.h should not be included by public GDAL headers [...]

Good point. Thanks for addressing that.

comment:4 by warmerdam, 12 years ago

Keywords: cpl_config.h added; haspatch removed
Milestone: 1.8.2

Removing the milestone. I don't think we will be addressing this before 2.0.

While I agree with Even's suggestion in general, in practice I don't see how we can do it since the public headers depend on many build specific configuration options from cpl_config.h. So I don't see how this can be accomplished.

comment:5 by Even Rouault, 12 years ago

Yes, that was exactly my conclusion after trying a bit in a tree...

comment:6 by Jukka Rahkonen, 9 years ago

Does "While I agree with Even's suggestion in general, in practice I don't see how we can do it..." mean => wontfix?

comment:7 by Jukka Rahkonen, 9 years ago

Continuously nagging, is this ticket worth keeping open?

comment:8 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.