Re: [perl #19357] [PATCH] sync strings.pod with code - Opportunity to write simple docs!

2002-12-26 Thread Leopold Toetsch
[EMAIL PROTECTED] (via RT) wrote:


# New Ticket Created by  [EMAIL PROTECTED] 
# Please include the string:  [perl #19357]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=19357 >


This patch modifies docs/strings.pod to match the code.

Thank you, applied.

leo





[perl #19462] [PATCH] Supress alignment warnings in jit.h and debug.h

2002-12-26 Thread via RT
# New Ticket Created by  Bruce Gray 
# Please include the string:  [perl #19462]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=19462 >


Summary:
Whenever jit.h or debug.h are '#include'ed, gcc 3.x emits 
warnings about structure padding. These patches fix the problem.

Detail:
When compiling with gcc 3.x, Configure turns on flag -Wpadded:
  -Wpadded
Warn if padding is included in a structure, either to align 
an element of the structure or to align the whole structure. 
Sometimes when this happens it is possible to rearrange the 
fields of the structure to reduce the padding and so make 
the structure smaller.

This is causing 95 warnings to be emitted in 427 lines of output:
 58include/parrot/debug.h:53: warning: padding struct to align `value'
 22 ../include/parrot/debug.h:53: warning: padding struct to align `value'
  5include/parrot/jit.h:35:   warning: padding struct to align `param'
  5include/parrot/jit.h:123:  warning: padding struct to align `block'
  5include/parrot/jit.h:149:  warning: padding struct size to alignment boundary
 58 In file included from include/parrot/interpreter.h:53,
 58  from include/parrot/parrot.h:198,
 58  from include/parrot/global_setup.h:18,
 22 In file included from ../include/parrot/interpreter.h:53,
 22  from ../include/parrot/parrot.h:198,
 22  from ../include/parrot/global_setup.h:18,
  1 In file included from nci.c:30:
  1 In file included from jit_debug.c:14:
  1 In file included from jit_cpu.c:12:
  1 In file included from jit.c:8:
  1 In file included from interpreter.c:19:
...
  1  from boolean.c:22:
  1  from array.c:27:  


In the past, these warnings have been resolved by 
rearranging the fields of the structure; that will not work 
in these cases. I have added dummy fields where the compiler 
was placing the padding, and marked each field with a 
comment.

Note: I am not convinced that this is the right way to 
handle these warnings on *every* platform. We may need a 
different approach to best handle the Crays and toasters. 
Due to the high number of errors on our major development
platform (Linux), please apply for (at least) the short term.

-- 
Hope this helps,
Bruce Gray



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/46288/36271/369a6d/warn_align_debug.patch

-- attachment  2 --
url: http://rt.perl.org/rt2/attach/46288/36272/58ece2/warn_align_jit.patch


Index: include/parrot/debug.h
===
RCS file: /cvs/public/parrot/include/parrot/debug.h,v
retrieving revision 1.18
diff -u -r1.18 debug.h
--- include/parrot/debug.h  13 Oct 2002 09:39:45 -  1.18
+++ include/parrot/debug.h  26 Dec 2002 21:48:25 -
@@ -50,6 +50,7 @@
 typedef struct PDB_condition {
 unsigned short  type;
 unsigned char   reg;
+unsigned char   dummy; /* For alignment */
 void*value;
 PDB_condition_ptr   next;
 } PDB_condition_t;

Index: include/parrot/jit.h
===
RCS file: /cvs/public/parrot/include/parrot/jit.h,v
retrieving revision 1.30
diff -u -r1.30 jit.h
--- include/parrot/jit.h14 Dec 2002 09:04:21 -  1.30
+++ include/parrot/jit.h26 Dec 2002 21:54:02 -
@@ -29,6 +29,7 @@
 int type;
 ptrdiff_t   native_offset;
 charskip;
+chardummy[3]; /* For alignment */
 union {
 opcode_topcode;
 void(*fptr)(void);
@@ -120,6 +121,7 @@
 unsigned int op_count;
 ptrdiff_tload_size;
 char isjit;
+char dummy[3]; /* For alignment */
 int  block;
 Parrot_jit_optimizer_section_ptr branch_target;
 Parrot_jit_optimizer_section_ptr prev;
@@ -146,6 +148,7 @@
 char*map_branch;
 opcode_t   **branch_list;
 unsigned charhas_unpredictable_jump;
+unsigned chardummy[3]; /* For alignment */
 } Parrot_jit_optimizer_t;
 
 /*  Parrot_jit_constant_pool_t



Re: [perl #17507] [PATCH] lib/Parrot/Configure/Step.pm - more litter cleanup

2002-12-26 Thread Bruce Gray
(Take 2: even "RT-Send-CC: perl6-internals  at  perl.org" is 
not getting out to the mailing list.)

URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17507

On 2002-09-22, I opened this ticket and submitted a patch.

On 2002-12-11, I updated (in RT) the ticket with more info, 
and brought the patch up-to-date with CVS. RT did not echo 
the update to the mailing list, so no one but me saw the update.

I have appended a copy of the update for peer review, and 
for the mailing list archives.

I have attached the most current version, 
step_move_if_diff_v3.patch Unless any objections are raised, 
please apply.

--
Hope this helps,
Bruce Gray


>Problem: *.tmp files, especially Makefile.tmp files,
>not being cleaned up.
>
>Cause: lib/Parrot/Configure/Step.pm provides copy_if_diff
>as an export, and also uses it internally. Sub copy_if_diff
>does not clean up the copied-from file, but it should in
>*some* cases. In other cases, the copied-from file is a not
>a temporary, and should not be removed.
>
>Solution: This patch adds 'move_if_diff', and changes 'copy'
>to 'move' only where appropriate.

Here is an updated version of the patch; it applies cleanly 
to the current CVS tree. First version suffered from 
Warnock's Dilemma, and was in DOS format.

The new patch, (step_move_if_diff_v2.patch), obsoletes
the old patch (step_move_if_diff.patch).

These are the files that the patch cleans up:
 classes/Makefile.tmp
 core_pmcs.c.tmp
 docs/Makefile.tmp
 include/parrot/config.h.tmp
 include/parrot/core_pmcs.h.tmp
 include/parrot/has_header.h.tmp
 languages/bf/Makefile.tmp
 languages/imcc/Makefile.tmp
 languages/jako/Makefile.tmp
 languages/Makefile.tmp
 languages/miniperl/Makefile.tmp
 languages/perl6/Makefile.tmp
 languages/scheme/Makefile.tmp
 lib/Parrot/PMC.pm.tmp
 libparrot.def.tmp
 Makefile.tmp
 myconfig.tmp
 test.c.tmp



Index: config/gen/config_h.pl
===
RCS file: /cvs/public/parrot/config/gen/config_h.pl,v
retrieving revision 1.4
diff -u -r1.4 config_h.pl
--- config/gen/config_h.pl  3 Sep 2002 07:08:35 -   1.4
+++ config/gen/config_h.pl  26 Dec 2002 21:56:52 -
@@ -37,7 +37,7 @@
   
   close HH;
 
-  copy_if_diff("$hh.tmp", $hh);
+  move_if_diff("$hh.tmp", $hh);
 }
 
 1;
Index: config/gen/core_pmcs.pl
===
RCS file: /cvs/public/parrot/config/gen/core_pmcs.pl,v
retrieving revision 1.4
diff -u -r1.4 core_pmcs.pl
--- config/gen/core_pmcs.pl 28 Oct 2002 13:58:00 -  1.4
+++ config/gen/core_pmcs.pl 26 Dec 2002 21:56:52 -
@@ -38,7 +38,7 @@
 
 close OUT;
 
-copy_if_diff("$file.tmp", $file);
+move_if_diff("$file.tmp", $file);
 }
 
 sub generate_c {
@@ -93,7 +93,7 @@
 
 close OUT;
 
-copy_if_diff("$file.tmp", $file);
+move_if_diff("$file.tmp", $file);
 }
 
 sub generate_pm {
@@ -129,7 +129,7 @@
 
 close OUT;
 
-copy_if_diff("$file.tmp", $file);
+move_if_diff("$file.tmp", $file);
 }
 
 1;
Index: lib/Parrot/Configure/Step.pm
===
RCS file: /cvs/public/parrot/lib/Parrot/Configure/Step.pm,v
retrieving revision 1.11
diff -u -r1.11 Step.pm
--- lib/Parrot/Configure/Step.pm12 Dec 2002 11:21:36 -  1.11
+++ lib/Parrot/Configure/Step.pm26 Dec 2002 21:56:53 -
@@ -9,13 +9,13 @@
 
 @EXPORT=();
 
-@EXPORT_OK=qw(prompt genfile copy_if_diff
+@EXPORT_OK=qw(prompt genfile copy_if_diff move_if_diff
   cc_gen cc_build cc_run cc_clean cc_run_capture);
 
 %EXPORT_TAGS=(
inter => ['prompt'],
auto  => [qw(cc_gen cc_build cc_run cc_clean cc_run_capture)],
-   gen   => [qw(genfile copy_if_diff)]
+   gen   => [qw(genfile copy_if_diff move_if_diff)]
 );
 
 my $redir_err = (($ENV{COMSPEC} || "")=~ /command\.com/i) ? "" : "2>&1";
@@ -76,6 +76,12 @@
 utime $now, $now, $to;
 }
 
+sub move_if_diff {
+my ($from, $to, $ignorePattern) = @_;
+copy_if_diff($from, $to, $ignorePattern);
+unlink $from;
+}
+
 sub genfile {
my($source, $target, %options)=@_;
 
@@ -121,7 +127,7 @@
close IN  or die "Can't close $source: $!";
close OUT or die "Can't close $target: $!";
 
-copy_if_diff("$target.tmp", $target, $options{ignorePattern});
+move_if_diff("$target.tmp", $target, $options{ignorePattern});
 }
 
 sub cc_gen {



[perl #19463] [PATCH] Sanity check for alignptrs/test_c.in

2002-12-26 Thread via RT
# New Ticket Created by  Bruce Gray 
# Please include the string:  [perl #19463]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=19463 >


This patch gives Configure's pointer alignment test a better 
error message for missing input.

-- 
Hope this helps,
Bruce Gray



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/46291/36278/4d67b2/alignptrs_argc.patch


Index: config/auto/alignptrs/test_c.in
===
RCS file: /cvs/public/parrot/config/auto/alignptrs/test_c.in,v
retrieving revision 1.6
diff -u -r1.6 test_c.in
--- config/auto/alignptrs/test_c.in 13 Sep 2002 10:54:53 -  1.6
+++ config/auto/alignptrs/test_c.in 26 Dec 2002 23:51:03 -
@@ -22,6 +22,12 @@
 void **ptr;
 
 int align = 0;
+
+if(argc != 2) {
+printf("FAILED - single command-line parameter required!\n");
+   return 1;
+}
+
 #ifdef SIGBUS
 signal(SIGBUS, bletch);
 #endif



[perl #19465] [PATCH] method_util.h lacks Vim local variables

2002-12-26 Thread via RT
# New Ticket Created by  Bruce Gray 
# Please include the string:  [perl #19465]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=19465 >


The file 'method_util.h' is missing the standard comment 
block that sets the behavior for the Vim editor. This patch 
adds the comment.

-- 
Hope this helps,
Bruce Gray



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/46294/36282/603db4/method_util_vi_fix.patch


Index: include/parrot/method_util.h
===
RCS file: /cvs/public/parrot/include/parrot/method_util.h,v
retrieving revision 1.4
diff -u -r1.4 method_util.h
--- include/parrot/method_util.h21 Nov 2002 01:47:47 -  1.4
+++ include/parrot/method_util.h27 Dec 2002 00:07:38 -
@@ -44,3 +44,13 @@
  Stack_Chunk_t * cur_stack, PMC * end_of_used_list);
 
 #endif /* PARROT_METHOD_UTIL_H_GUARD */
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */



[perl #19467] [PATCH] win32.h - MinGW #pragma warnings

2002-12-26 Thread via RT
# New Ticket Created by  Bruce Gray 
# Please include the string:  [perl #19467]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=19467 >


The gcc compiler in MinGW (win32) emits warnings for invalid pragmas in win32.h 
(platform.h).
This patch uses '#ifndef __GNUC__' to hide the pragmas from gcc.

-- 
Hope this helps,
Bruce Gray



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/46297/36286/58aacf/win32_h_MinGW.patch


Index: config/gen/platform/win32.h
===
RCS file: /cvs/public/parrot/config/gen/platform/win32.h,v
retrieving revision 1.6
diff -u -r1.6 win32.h
--- config/gen/platform/win32.h 23 Jul 2002 07:25:36 -  1.6
+++ config/gen/platform/win32.h 27 Dec 2002 00:43:51 -
@@ -13,6 +13,7 @@
 #  define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
 #endif
 
+#ifndef __GNUC__
 /* These disable certain Level 4 Warnings */
 #pragma warning( disable: 4100 ) /* disables 'unreferenced formal parameter'
   * warnings */
@@ -21,6 +22,8 @@
   * include files */
 #pragma warning( disable: 4505 ) /* disables 'unreferenced local function has
   * been removed' warnings in header files */
+#endif
+
 /*
 ** Miscellaneous:
 */



[perl #19470] [PATCH] --cc=FOO fails for Win32

2002-12-26 Thread via RT
# New Ticket Created by  Bruce Gray 
# Please include the string:  [perl #19470]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt2/Ticket/Display.html?id=19470 >


In hints/mswin32.pl, there is code in place to customize the 
build environment based on the value of $cc. However, $cc is 
only populated by the 'cc' from the local 'perl -V'; the 
command-line flag '-cc=FOO' is not used here. This patch 
corrects that problem, as well as missing 'link', 'ar', and 'slash' 
values for MinGW.

Tested under MinGW 2.0.0-3 (current) using these commands:
perl Configure.pl --debugging --cc=gcc
mingw32-make
mingw32-make test
Many warnings remain, but only one test fails (sprintf).
With this patch, Parrot now supports MinGW out-of-the-box!

-- 
Hope this helps,
Bruce Gray



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/46301/36291/613a29/mswin32_pl_MinGW.patch


Index: config/init/hints.pl
===
RCS file: /cvs/public/parrot/config/init/hints.pl,v
retrieving revision 1.3
diff -u -r1.3 hints.pl
--- config/init/hints.pl9 Dec 2002 04:02:09 -   1.3
+++ config/init/hints.pl27 Dec 2002 01:39:50 -
@@ -6,7 +6,7 @@
 
 $description="Loading platform and local hints files...";
 
-@args=();
+@args = qw( cc );
 
 sub runstep {
   my $hints = "config/init/hints/" . lc($^O) . ".pl";
Index: config/init/hints/mswin32.pl
===
RCS file: /cvs/public/parrot/config/init/hints/mswin32.pl,v
retrieving revision 1.6
diff -u -r1.6 mswin32.pl
--- config/init/hints/mswin32.pl11 Oct 2002 01:46:52 -  1.6
+++ config/init/hints/mswin32.pl27 Dec 2002 01:39:50 -
@@ -1,9 +1,18 @@
 {
+   my %args;
+   @args{@args}=@_;
+
my($cc, $ccflags, $libs)=Configure::Data->get(qw(cc ccflags libs));
+
+   # Later in the Parrot::Configure::RunSteps->runsteps process,
+   # inter/progs.pl will merge the command-line overrides with the defaults.
+   # We do one bit of its work early here, because we need the result now.
+   $cc = $args{cc} if defined $args{cc};
+
my $is_msvc  = grep { $cc eq $_ } ( qw(cl cl.exe) );
my $is_mingw = grep { $cc eq $_ } ( qw(gcc gcc.exe) );
my $is_bcc   = grep { $cc eq $_ } ( qw(bcc32 bcc32.exe) );
-   
+
Configure::Data->set(
rm_f  => '$(PERL) -MExtUtils::Command -e rm_f',
rm_rf => '$(PERL) -MExtUtils::Command -e rm_rf',
@@ -66,8 +75,10 @@
elsif( $is_mingw ) {
$libs='' if $libs =~ /\.lib\s/i;
Configure::Data->set(
-   ld => 'gcc',
-   libs => $libs
+   link  => 'gcc',
+   libs  => $libs,
+   slash => '\\',
+   ar=> 'ar',
);
}
 }