Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aS7Jx-0007uS-9A for pgsql-bugs@arkaria.postgresql.org; Sat, 06 Feb 2016 18:10:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aS7Jw-0003X2-Jb for pgsql-bugs@arkaria.postgresql.org; Sat, 06 Feb 2016 18:10:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aS7JJ-0002pD-V8 for pgsql-bugs@postgresql.org; Sat, 06 Feb 2016 18:10:18 +0000 Received: from 212.17.106.136.static.inode.at ([212.17.106.136] helo=zeno.hjp.at) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aS7JG-0000EZ-S7 for pgsql-bugs@postgresql.org; Sat, 06 Feb 2016 18:10:16 +0000 Received: by zeno.hjp.at (Postfix, from userid 1000) id 5B5D2408F; Sat, 6 Feb 2016 19:10:09 +0100 (CET) Date: Sat, 6 Feb 2016 19:10:08 +0100 From: "Peter J. Holzer" To: pgsql-bugs@postgresql.org Subject: Re: BUG #13898: ecpg complains on nested comments in /usr/pgsql-9.4/include/informix/esql/datetime.h Message-ID: <20160206181008.GC8832@hjp.at> References: <20160129002202.2534.66092@wrigleys.postgresql.org> <1454155301.23207.80.camel@postgresql.org> <37edb08437e746b9bfa4d430ec4f738a@se10mbx02.org.nasdaqomx.com> <20160201085656.GA5967@feivel> <5dd13ee64104460c83de2e113a5907ce@se10mbx02.org.nasdaqomx.com> <20160201094337.GA9280@feivel> <68728.1454320604@sss.pgh.pa.us> <20160201121620.GA20662@feivel> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ALfTUftag+2gvp1h" Content-Disposition: inline In-Reply-To: <20160201121620.GA20662@feivel> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --ALfTUftag+2gvp1h Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2016-02-01 13:16:20 +0100, Michael Meskes wrote: > > and ends on an ordinary line. I am not sure what the C standard says > > about such cases, but I can certainly imagine that some tools might not > > be very happy with that. >=20 > We/I have to figure out what the standard says, because if it allows > these comments, the lexer itself has to be fixed to work correctly > instead of just fixing the header files. The relevant translation phases are 3 and 4 according to the C standard (section 5.1.1.2 in C11): | 3. The source file is decomposed into preprocessing tokens7) and | sequences of white-space characters (including comments). A source | file shall not end in a partial preprocessing token or in a partial | comment. Each comment is replaced by one space character. New-line | characters are retained. Whether each nonempty sequence of | white-space characters other than new-line is retained or replaced | by one space character is implementation-defined. | | 4. Preprocessing directives are executed, macro invocations are | expanded, and _Pragma unary operator expressions are executed. If a | character sequence that matches the syntax of a universal character | name is produced by token concatenation (6.10.3.3), the behavior is | undefined. A #include preprocessing directive causes the named | header or source file to be processed from phase 1 through phase 4, | recursively. All preprocessing directives are then deleted. Comments are replaced with whitespace in phase 3, preprocessing directives are are only considered in phase 4. So code like=20 ---------------------------------------------------------------------------- #ifndef _ECPGLIB_H /* source created by ecpg which defines thes= e=E2=90=A4 * symbols */=E2=90=A4 ---------------------------------------------------------------------------- is valid C and should be exactly equivalent to ---------------------------------------------------------------------------- #ifndef _ECPGLIB_H =E2=90=A4 =E2=90=A4 ---------------------------------------------------------------------------- (=E2=90=A4 denotes a newline character here) hp --=20 _ | Peter J. Holzer | I want to forget all about both belts and |_|_) | | suspenders; instead, I want to buy pants=20 | | | hjp@hjp.at | that actually fit. __/ | http://www.hjp.at/ | -- http://noncombatant.org/ --ALfTUftag+2gvp1h Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBVrY2/vIOSFES/ihdAQLQmw//TpVzN9fzvlCAqKplaR+h0sxPCR41a2Xl AHcEZ6QKAKAvUUofW1g+rOZILoWqqi+lc1nUcHUW2+LjcDDGKllEUD/AeLh4d3n/ iFjAnCyH49Qp/OKxBosVZuqz6bp0h18HUYWwdsGW9AO5lJdFkJR5lQ49SWRtIXtz 8/ZPaFjdbLnpecH4Ek5iHqQkZu91e0hjnziopRxHs2PjQa9EHia2ClSMCgLyYrWi Zdur0a91jVCXetRfxqYtx8OjUT1gBjqp3WL7r6iX7uHrCC6cI2VyiLMqRQ6yCDOF cO2s4F7nV3hxRbagCZmQYET3wLxQ2eMyn36OD2oWOUM15tbMYjjkD1zDn5PVfC5w gckxE3BUEH9UkCwQtdIQrPF+x5hmgZZBqkC9wOL8fVL6s12II/GpJC900hZ+7P5n 11gc8+92Ngpnw1XAMtrMZpqmjkqxkhGqKogzdAVBzH30PauwzyQ6dCjHLLDoH6c2 Bk57chEd6LRnKdLgkIpfQlyIA2Da8O0Ld5EXlaH3zbaXRYFS36PwV7dPNwF9uZaa WAXJOt6pq2ZWlltxlmeAs5iXHBcTVrhcRK1xTkZFh1MoUJP79Pq5mWQ5KqIO2FkL 6tEQmM3ATE+TanAat72NUdsuZZ95O+G8kzDSB0KLnJtwZgIQAExPhmxTZNPcCpPc B/6p8GT6yJc= =g1GL -----END PGP SIGNATURE----- --ALfTUftag+2gvp1h--