<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:19:06 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CDRIVER-3810] Including bson-compat.h before inttypes.h may result in duplicate constant definitions</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3810</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Reported in &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2245?focusedCommentId=3463998&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-3463998&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;this comment&lt;/a&gt; of &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2245&quot; title=&quot;Macro redefinition of printf integer formats for VS2015&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2245&quot;&gt;&lt;del&gt;CDRIVER-2245&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1526612">CDRIVER-3810</key>
            <summary>Including bson-compat.h before inttypes.h may result in duplicate constant definitions</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="kevin.albertson@mongodb.com">Kevin Albertson</reporter>
                        <labels>
                    </labels>
                <created>Tue, 27 Oct 2020 20:11:11 +0000</created>
                <updated>Mon, 2 Nov 2020 20:37:59 +0000</updated>
                            <resolved>Mon, 2 Nov 2020 20:37:59 +0000</resolved>
                                    <version>1.9.5</version>
                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3466688" author="JIRAUSER1257415" created="Wed, 28 Oct 2020 17:23:45 +0000"  >&lt;p&gt;This is not a blocker for us at all, now that I know that adding #include &amp;lt;inttypes.h&amp;gt; before #include &quot;bson.h&quot; prevents it from manifesting.&lt;/p&gt;</comment>
                            <comment id="3466234" author="kevin.albertson" created="Wed, 28 Oct 2020 14:12:19 +0000"  >&lt;p&gt;bson-stdint-win32.h was removed in&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2473&quot; title=&quot;Port bson-stdint.h build logic from Autotools to CMake&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2473&quot;&gt;&lt;del&gt;CDRIVER-2473&lt;/del&gt;&lt;/a&gt; in this commit: &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/abc882dec9eb5c67fc6e344440ee81e9d33d3459&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/abc882dec9eb5c67fc6e344440ee81e9d33d3459&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Not sure what version of MongoDB the client has&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2473&quot; title=&quot;Port bson-stdint.h build logic from Autotools to CMake&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2473&quot;&gt;&lt;del&gt;CDRIVER-2473&lt;/del&gt;&lt;/a&gt; was done in version 1.10.0. They can determine the version of libbson by inspecting the installed &lt;tt&gt;bson-version.h&lt;/tt&gt; header&apos;s &lt;tt&gt;BSON_VERSION&lt;/tt&gt; macro. We do not backport bug fixes to previous minor versions unless they have high impact to limit the risk of users upgrading to the latest patch release. Are they able to upgrade libmongoc and libbson to a newer version?&lt;/p&gt;</comment>
                            <comment id="3465603" author="JIRAUSER1257415" created="Tue, 27 Oct 2020 23:20:19 +0000"  >&lt;p&gt;Title is currently incorrect; should say &quot;before inttypes.h&quot;.&lt;/p&gt;</comment>
                            <comment id="3465471" author="JIRAUSER1257415" created="Tue, 27 Oct 2020 21:10:58 +0000"  >&lt;p&gt;The version we have #includes &amp;lt;stdint.h&amp;gt;; it does NOT #include &amp;lt;inttypes.h&amp;gt;.&lt;/p&gt;

&lt;p&gt;Snippet from bson-stdint-win32.h:&lt;br/&gt;
#if _MSC_VER &amp;gt;= 1600 // [&lt;br/&gt;
#include &amp;lt;stdint.h&amp;gt;&lt;br/&gt;
#else // ] _MSC_VER &amp;gt;= 1600 [&lt;/p&gt;</comment>
                            <comment id="3465413" author="JIRAUSER1257415" created="Tue, 27 Oct 2020 20:30:37 +0000"  >&lt;p&gt;&lt;b&gt;Correction:&#160; &amp;lt;inttypes.h&amp;gt; not &amp;lt;stdint.h&amp;gt;!&#160; bson-compat.h does not #include &amp;lt;inttypes.h&amp;gt;.&lt;/b&gt;&#160; It does #include &amp;lt;stdint.h&amp;gt;, however &amp;lt;inttypes.h&amp;gt; is what defines PRIi32 etc.&lt;/p&gt;

&lt;p&gt;This issue is due to the following sequence:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;bson.h is #included; it #includes bson-compat.h.&#160;&lt;br/&gt;
 If bson.h is #included before &amp;lt;inttypes.h&amp;gt; is #included in user code:&lt;/li&gt;
	&lt;li&gt;In bson-compat.h there is code defining PRI macros with naming that collides with the macros in &amp;lt;inttypes.h&amp;gt; such as:&lt;br/&gt;
 #ifndef PRIi32&lt;br/&gt;
 #define PRIi32 &quot;d&quot;&lt;br/&gt;
 #endif&lt;br/&gt;
 Because &amp;lt;inttypes.h&amp;gt; has not yet been #included, this will #define PRIi32 to &quot;d&quot;.&lt;/li&gt;
	&lt;li&gt;&amp;lt;inttypes.h&amp;gt; is then #included in user code, and (re-)#defines PRIi32 etc.:&lt;br/&gt;
 #define PRIi32 &quot;i&quot;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Using Visual Studio 2017 and a version of inttypes.h that appears to be from a Windows 10? SDK;&#160;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\inttypes.h.&lt;/p&gt;

&lt;p&gt;Build is done inside Visual Studio.&lt;/p&gt;

&lt;p&gt;Not sure what version of MongoDB the client has; bson.h, bson-compat.h show 2013 copyrights.&#160;&lt;/p&gt;

&lt;p&gt;_MSC_VER displayed as 1916.&lt;/p&gt;

&lt;p&gt;I do see:&lt;br/&gt;
 #if _MSC_VER &amp;gt;= 1600 // [&lt;br/&gt;
 #include &amp;lt;stdint.h&amp;gt;&lt;br/&gt;
 #else // ] _MSC_VER &amp;gt;= 1600 [&lt;br/&gt;
 And find that this &amp;lt;stdint.h&amp;gt; has path:&lt;br/&gt;
 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\stdint.h&lt;/p&gt;

&lt;p&gt;One possible (minimal) solution would be to #include &amp;lt;inttypes.h&amp;gt; in bson-compat.h, so that the standard definitions are already present before the possibly-conflicting #defines.&lt;/p&gt;</comment>
                            <comment id="3465386" author="kevin.albertson" created="Tue, 27 Oct 2020 20:18:49 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=scottw%40attinc.com&quot; class=&quot;user-hover&quot; rel=&quot;scottw@attinc.com&quot;&gt;scottw@attinc.com&lt;/a&gt;, bson-compat.h does &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/master/src/libbson/src/bson/bson-compat.h#L85:L87&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;attempt to include inttypes.h&lt;/a&gt; for non-Windows and VS 2013 or newer before conditionally defining those constants:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;#if !defined(_MSC_VER) || (_MSC_VER &amp;gt;= 1800)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;#include &amp;lt;inttypes.h&amp;gt;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;#endif&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;Perhaps that check is too conservative. Are you compiling with Visual Studio earlier than 2013?&lt;/p&gt;

&lt;p&gt;Additionally, can you include the cmake and build commands you are using to build, as well as the output and relevant warning?&lt;/p&gt;

&lt;p&gt;Thank you,&lt;br/&gt;
 Kevin&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hy0y3r:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>