Additional fixes to ecpg - please apply patch

Started by Nicolas Bazinalmost 24 years ago6 messages
#1Nicolas Bazin
nbazin@ingenico.com.au
1 attachment(s)

This new patch corrects 2 new bugs:
bug 1:
EXEC SQL define JOKER '?';
EXEC SQL define LINE "LINE";
could not be parsed

bug 2:
EXEC SQL define LEN 2;
memset(dst, '?', LEN);

was translated into

memset(dst, '?', 2
#line XX "thefile.ec"
);

which could not be compiled with gcc for instance

Nicolas BAZIN

Attachments:

pgc.l.diffapplication/octet-stream; name=pgc.l.diffDownload
*** pgc.l Fri Mar  8 07:02:51 2002
--- /home/postgres/postgresql-7.2.old/src/interfaces/ecpg/preproc/pgc.l Tue Mar  5 11:52:36 2002
***************
*** 773,778 ****
  			}
  <def>{space}*";"	{
  				struct _defines *ptr, *this;
                                  for (ptr = defines; ptr != NULL; ptr = ptr->next)
                                  {
                                       if (strcmp(old, ptr->old) == 0)
--- 773,779 ----
  			}
  <def>{space}*";"	{
  				struct _defines *ptr, *this;
+         
                                  for (ptr = defines; ptr != NULL; ptr = ptr->next)
                                  {
                                       if (strcmp(old, ptr->old) == 0)
***************
*** 796,802 ****
  
  				BEGIN(C);
  			}
! <def>{space}*(\"|\'|[^";"])*{space}*		{
  				addlit(yytext, yyleng);
  			}
  
--- 797,803 ----
  
  				BEGIN(C);
  			}
! <def>[^";"]		{
  				addlit(yytext, yyleng);
  			}
  
***************
*** 867,872 ****
  			  if (yy_buffer == NULL) {
  				if ( preproc_tos > 0 ) {
  					preproc_tos = 0;
  				mmerror(PARSE_ERROR, ET_FATAL, "Missing 'EXEC SQL ENDIF;'");
  				}
  				yyterminate();
--- 868,874 ----
  			  if (yy_buffer == NULL) {
  			  	if ( preproc_tos > 0 ) {
  			      		preproc_tos = 0;
+ 
  			      		mmerror(PARSE_ERROR, ET_FATAL, "Missing 'EXEC SQL ENDIF;'");
  			  	}
  				yyterminate();
***************
*** 888,894 ****
  
  				yy_buffer = yy_buffer->next;
  				free(yb);
! //				output_line_number();
  			  }
  			}
  %%
--- 890,896 ----
  
  				yy_buffer = yy_buffer->next;
  				free(yb);
! 				output_line_number();
  			  }
  			}
  %%
#2Michael Meskes
meskes@postgresql.org
In reply to: Nicolas Bazin (#1)
Re: Additional fixes to ecpg - please apply patch

It seems you patch is reversed.

Anyway, I will look into it. I will have to change it some though as it
contains C++ comments. :-)

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

#3Michael Meskes
meskes@postgresql.org
In reply to: Nicolas Bazin (#1)
Re: Additional fixes to ecpg - please apply patch

On Fri, Mar 08, 2002 at 06:35:18PM +1100, Nicolas Bazin wrote:

This new patch corrects 2 new bugs:

Slighlty differently fixed this in CVS.

Thanks for reporting the bugs. Please tell me of my fix is not
sufficient.

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

#4jtv
jtv@xs4all.nl
In reply to: Michael Meskes (#2)
Re: Additional fixes to ecpg - please apply patch

On Sun, Mar 10, 2002 at 12:40:36PM +0100, Michael Meskes wrote:

Anyway, I will look into it. I will have to change it some though as it
contains C++ comments. :-)

Which are also valid C comments nowadays, IIRC. OTOH not all compilers
seem to honour that change...

Jeroen

#5Michael Meskes
meskes@postgresql.org
In reply to: jtv (#4)
Re: Additional fixes to ecpg - please apply patch

On Sun, Mar 10, 2002 at 02:28:12PM +0100, jtv wrote:

On Sun, Mar 10, 2002 at 12:40:36PM +0100, Michael Meskes wrote:

Anyway, I will look into it. I will have to change it some though as it
contains C++ comments. :-)

Which are also valid C comments nowadays, IIRC. OTOH not all compilers
seem to honour that change...

Yes, that's what I meant. :-(

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

#6Bruce Momjian
pgman@candle.pha.pa.us
In reply to: jtv (#4)
Re: [HACKERS] Additional fixes to ecpg - please apply patch

jtv wrote:

On Sun, Mar 10, 2002 at 12:40:36PM +0100, Michael Meskes wrote:

Anyway, I will look into it. I will have to change it some though as it
contains C++ comments. :-)

Which are also valid C comments nowadays, IIRC. OTOH not all compilers
seem to honour that change...

We don't support // comments in PostgreSQL in C. Too many platforms
don't accept them. We are not targeting only modern systems.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026