Re: [HACKERS] Compiling C++ extensions on MSVC using scripts in src/tools

2014-12-17 Thread Heikki Linnakangas

On 11/27/2014 06:39 AM, Michael Paquier wrote:

On Thu, Nov 27, 2014 at 1:40 AM, Tom Lane t...@sss.pgh.pa.us wrote:

Andrew Dunstan and...@dunslane.net writes:

This doesn't seem to me to be terribly well expressed (I know it's not your 
fault, quite possibly it's mine.) Perhaps we should replace
 [r]?[cyl](pp)?
with
 (c|cpp|y|l|rc)


+1 ... the original coding is illegible already, not to mention wrong
since it will match stuff it shouldn't.

Yes even the older code could find matches with ry or rl. Except that,
lpp and ypp could be present as well. OK, there are low chances to be
present in a Postgres extension (I don't have such extensions myself),
still they could. So I think that this expression should be written
like that instead:
(c|cpp|l|lpp|y|ypp|rc).
Updated patch is attached.


If .lp and .ypp files are supposed to be Bison and Flex files with C++ 
code in them, it wouldn't work anyway, because the rules elsewhere in 
the MSVC scripts just check for /\.y$/) to decide whether to run bison 
on it.


I committed Andrew's suggestion:

/^(.*)\\([^\\]+)\.(c|cpp|y|l|rc)$/

- Heikki



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Compiling C++ extensions on MSVC using scripts in src/tools

2014-12-17 Thread Michael Paquier
On Thu, Dec 18, 2014 at 4:55 AM, Heikki Linnakangas
hlinnakan...@vmware.com wrote:
 If .lp and .ypp files are supposed to be Bison and Flex files with C++ code
 in them, it wouldn't work anyway, because the rules elsewhere in the MSVC
 scripts just check for /\.y$/) to decide whether to run bison on it.

 I committed Andrew's suggestion:
 /^(.*)\\([^\\]+)\.(c|cpp|y|l|rc)$/
Thanks, that's enough for my stuff.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Compiling C++ extensions on MSVC using scripts in src/tools

2014-11-26 Thread Andrew Dunstan


On 11/25/2014 11:46 PM, Michael Paquier wrote:

Hi all,

In the stuff I work on in a daily basis there are a couple of
extensions written in C++, compiling them with MSVC on Windows using
slightly-different scripts available in src/tools after copying them
directly in contrib/. However, the build scripts available in
src/tools/msvc are not able to detect files suffixed as cpp or
similar. Attached is a two-line patch that enables their detection. I
believe this would be useful for packagers on Windows.




+ unless ($fileNameWithPath =~ 
/^(.*)\\([^\\]+)\.[r]?[cyl](pp)?$/);


This doesn't seem to me to be terribly well expressed (I know it's not your 
fault, quite possibly it's mine.) Perhaps we should replace

   [r]?[cyl](pp)?

with

   (c|cpp|y|l|rc)

which I think is what's intended, and seems much less obscure to me.


cheers

andrew


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Compiling C++ extensions on MSVC using scripts in src/tools

2014-11-26 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes:
 This doesn't seem to me to be terribly well expressed (I know it's not your 
 fault, quite possibly it's mine.) Perhaps we should replace
 [r]?[cyl](pp)?
 with
 (c|cpp|y|l|rc)

+1 ... the original coding is illegible already, not to mention wrong
since it will match stuff it shouldn't.

regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Compiling C++ extensions on MSVC using scripts in src/tools

2014-11-26 Thread Michael Paquier
On Thu, Nov 27, 2014 at 1:40 AM, Tom Lane t...@sss.pgh.pa.us wrote:
 Andrew Dunstan and...@dunslane.net writes:
 This doesn't seem to me to be terribly well expressed (I know it's not your 
 fault, quite possibly it's mine.) Perhaps we should replace
 [r]?[cyl](pp)?
 with
 (c|cpp|y|l|rc)

 +1 ... the original coding is illegible already, not to mention wrong
 since it will match stuff it shouldn't.
Yes even the older code could find matches with ry or rl. Except that,
lpp and ypp could be present as well. OK, there are low chances to be
present in a Postgres extension (I don't have such extensions myself),
still they could. So I think that this expression should be written
like that instead:
(c|cpp|l|lpp|y|ypp|rc).
Updated patch is attached.
-- 
Michael
From e4f095d3ba2ac29ccbc00f44306c65d0d4ee678f Mon Sep 17 00:00:00 2001
From: Michael Paquier mich...@otacoo.com
Date: Tue, 25 Nov 2014 20:35:55 -0800
Subject: [PATCH] Allow detection of c++ files in MSVC scripts for extensions

This makes possible the detection of c++ files (cpp, lpp, ypp) for
extensions copied in contrib/ and built with MSVC, be it MS or VC.
---
 src/tools/msvc/MSBuildProject.pm | 2 +-
 src/tools/msvc/VCBuildProject.pm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm
index e1c8d81..d33c8ae 100644
--- a/src/tools/msvc/MSBuildProject.pm
+++ b/src/tools/msvc/MSBuildProject.pm
@@ -127,7 +127,7 @@ EOF
 	foreach my $fileNameWithPath (sort keys %{ $self-{files} })
 	{
 		confess Bad format filename '$fileNameWithPath'\n
-		  unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
+		  unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.(c|cpp|l|lpp|rc|y|ypp)$/);
 		my $dir  = $1;
 		my $fileName = $2;
 		if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/)
diff --git a/src/tools/msvc/VCBuildProject.pm b/src/tools/msvc/VCBuildProject.pm
index 335a1f0..af68528 100644
--- a/src/tools/msvc/VCBuildProject.pm
+++ b/src/tools/msvc/VCBuildProject.pm
@@ -71,7 +71,7 @@ EOF
 	foreach my $fileNameWithPath (sort keys %{ $self-{files} })
 	{
 		confess Bad format filename '$fileNameWithPath'\n
-		  unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
+		  unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.(c|cpp|l|lpp|rc|y|ypp)$/);
 		my $dir  = $1;
 		my $file = $2;
 
-- 
2.1.3


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Compiling C++ extensions on MSVC using scripts in src/tools

2014-11-25 Thread Michael Paquier
Hi all,

In the stuff I work on in a daily basis there are a couple of
extensions written in C++, compiling them with MSVC on Windows using
slightly-different scripts available in src/tools after copying them
directly in contrib/. However, the build scripts available in
src/tools/msvc are not able to detect files suffixed as cpp or
similar. Attached is a two-line patch that enables their detection. I
believe this would be useful for packagers on Windows.

Patch is added to the next commit fest.
Regards,
-- 
Michael
diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm
index e1c8d81..75d02ba 100644
--- a/src/tools/msvc/MSBuildProject.pm
+++ b/src/tools/msvc/MSBuildProject.pm
@@ -127,7 +127,7 @@ EOF
 	foreach my $fileNameWithPath (sort keys %{ $self-{files} })
 	{
 		confess Bad format filename '$fileNameWithPath'\n
-		  unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
+		  unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl](pp)?$/);
 		my $dir  = $1;
 		my $fileName = $2;
 		if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/)
diff --git a/src/tools/msvc/VCBuildProject.pm b/src/tools/msvc/VCBuildProject.pm
index 335a1f0..eed5545 100644
--- a/src/tools/msvc/VCBuildProject.pm
+++ b/src/tools/msvc/VCBuildProject.pm
@@ -71,7 +71,7 @@ EOF
 	foreach my $fileNameWithPath (sort keys %{ $self-{files} })
 	{
 		confess Bad format filename '$fileNameWithPath'\n
-		  unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl]$/);
+		  unless ($fileNameWithPath =~ /^(.*)\\([^\\]+)\.[r]?[cyl](pp)?$/);
 		my $dir  = $1;
 		my $file = $2;
 

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers