Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sttne-002VnT-3t for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Sep 2024 19:05:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sttnd-00Cq1m-Ft for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Sep 2024 19:05:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sttnd-00Cq1e-63 for pgsql-hackers@lists.postgresql.org; Thu, 26 Sep 2024 19:05:13 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sttnZ-001EiJ-3m for pgsql-hackers@lists.postgresql.org; Thu, 26 Sep 2024 19:05:12 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 48QJ4wko349007; Thu, 26 Sep 2024 15:04:59 -0400 From: Tom Lane To: "Winter Loo" cc: pgsql-hackers@lists.postgresql.org Subject: Re: [ecpg bug]: can not use single '*' in multi-line comment after c preprocessor directives In-reply-to: <577fa287.6e4e.192281c7d38.Coremail.winterloo@126.com> References: <577fa287.6e4e.192281c7d38.Coremail.winterloo@126.com> Comments: In-reply-to "Winter Loo" message dated "Wed, 25 Sep 2024 15:36:48 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <349005.1727377498.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 26 Sep 2024 15:04:58 -0400 Message-ID: <349006.1727377498@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Winter Loo" writes: > The following code fails to pass the ecpg compilation, although it is ac= cepted by the gcc compiler. Yeah ... an isolated "/" inside the comment doesn't work either. > Confused! I am uncertain how to rectify the regex. I hope someone can ad= dress this bug. I poked at this for awhile and concluded that we probably cannot make it work with a single regexp for "cppline". The right thing would involve an exclusive start condition for parsing a cppline, more or less like the way that /* comments are parsed in the start condition. This is kind of a lot of work compared to the value :-(. Maybe somebody else would like to take a crack at it, but I can't get excited enough about it. There are other deficiencies too in ecpg's handling of these things, like the fact that (I think) comments are mishandled in #include directives. regards, tom lane