Ticket #446 (new cage)

Opened 6 years ago

Last modified 4 years ago

[CAGE] Fixed a few warnings and a NCI example on Windows using MSVS

Reported by: ujwal Owned by: cotto
Priority: normal Milestone:
Component: configure Version: trunk
Severity: medium Keywords:
Cc: Language:
Patch status: new Platform: win32

Description

Fixed warnings like unused variables, unreachable code in core.ops
config/gen/platform/win32/exec.c
config/gen/platform/win32/stat.c
include/parrot/encoding.h
src/embed.c
src/oo.c
src/ops/core.ops
src/packfile.c
src/spf_render.c
src/string/encoding.c
src/string/encoding/fixed_8.c
src/thread.c

also Fixed a NCI example
examples/nci/PQt.C
examples/nci/PQt.cpp
examples/nci/QtHelloWorld.pasm
examples/nci/QtHelloWorld.pir

this is a good way to get comfortable with code base :)

 CREDITS                          |    2
 config/gen/platform/win32/exec.c |    3
 config/gen/platform/win32/stat.c |    3
 examples/nci/PQt.C               |  149 --------------------------------------
 examples/nci/PQt.cpp             |  151 +++++++++++++++++++++++++++++++++++++++
 examples/nci/QtHelloWorld.pasm   |   22 ++---
 examples/nci/QtHelloWorld.pir    |   69 +++++++++++++++++
 include/parrot/encoding.h        |    8 +-
 src/embed.c                      |    2
 src/oo.c                         |    2
 src/ops/core.ops                 |   13 ++-
 src/packfile.c                   |    2
 src/spf_render.c                 |    3
 src/string/encoding.c            |   10 ++
 src/string/encoding/fixed_8.c    |    8 +-
 src/thread.c                     |    6 +
 16 files changed, 275 insertions(+), 178 deletions(-)
:
[FIXED]src\ops\core_ops.c
[FIXED]src\ops\core.ops(920) : warning C4189: 'resume' : local variable is initialized but not referenced
[FIXED]src\ops\core.ops(920) : warning C4189: 'resume' : local variable is initialized but not referenced
[FIXED]src\ops\core.ops(920) : warning C4189: 'resume' : local variable is initialized but not referenced
[FIXED]src\ops\core.ops(920) : warning C4189: 'resume' : local variable is initialized but not referenced
:
[NOT FIXED]src\ops\experimental.ops(52) : warning C4189: 'unused' : local variable is initialized but not referenced
:
:
[FIXED]f:\git\rakudo\parrot\src\ops\core.ops(1453) : warning C4702: unreachable code
[FIXED]f:\git\rakudo\parrot\src\ops\core.ops(1472) : warning C4702: unreachable code
[FIXED]f:\git\rakudo\parrot\src\ops\core.ops(1472) : warning C4702: unreachable code
src\ops\core_ops_switch.c
[FIXED]src\ops\core.ops(920) : warning C4189: 'resume' : local variable is initialized but not referenced
[FIXED]src\ops\core.ops(920) : warning C4189: 'resume' : local variable is initialized but not referenced
[FIXED]src\ops\core.ops(920) : warning C4189: 'resume' : local variable is initialized but not referenced
[FIXED]src\ops\core.ops(920) : warning C4189: 'resume' : local variable is initialized but not referenced
:
[FIXED]src\embed.c(1296) : warning C4189: 'pf' : local variable is initialized but not referenced
[FIXED]src\string\encoding.c
[FIXED]src\string\encoding.c(156) : warning C4646: function declared with __declspec(noreturn) has non-void return type
[FIXED]src\string\encoding.c(445) : warning C4646: function declared with __declspec(noreturn) has non-void return type
:
:
[FIXED]src\packfile.c(868) : warning C4189: 'pf' : local variable is initialized but not referenced
:
[FIXED]src\spf_render.c
[FIXED]src\spf_render.c(115) : warning C4005: 'snprintf' : macro redefinition
[FIXED]F:\git\rakudo\parrot\include\parrot/misc.h(28) : see previous definition of 'snprintf'
:
:
[FIXED]config/gen/platform/win32/stat.c(115) : warning C4244: '=' : conversion from 'time_t' to 'INTVAL', possible loss of data
[FIXED]config/gen/platform/win32/stat.c(118) : warning C4244: '=' : conversion from 'time_t' to 'INTVAL', possible loss of data
[FIXED]config/gen/platform/win32/stat.c(121) : warning C4244: '=' : conversion from 'time_t' to 'INTVAL', possible loss of data
[FIXED]config/gen/platform/win32/exec.c(218) : warning C4090: 'function' : different 'const' qualifiers
src\pmc_freeze.c
f:\git\rakudo\parrot\src\pmc_freeze.c(1725) : warning C4706: assignment within conditional expression
:
:
[FIXED]src\thread.c
[FIXED]f:\git\rakudo\parrot\src\thread.c(639) : warning C4701: potentially uninitialized local variable 'val_sub' used
[FIXED]f:\git\rakudo\parrot\src\thread.c(503) : warning C4700: uninitialized local variable 'interp' used
:
:
[FIXED]src\string\encoding\fixed_8.c
[FIXED]src\string\encoding\fixed_8.c(236) : warning C4646: function declared with __declspec(noreturn) has non-void return type
:


Attachments

build-output.txt Download (95.4 KB) - added by ujwal 6 years ago.
my build output before fixing
warnings_nci_example.patch Download (16.5 KB) - added by ujwal 6 years ago.
[PATCH]

Change History

Changed 6 years ago by ujwal

my build output before fixing

Changed 6 years ago by ujwal

[PATCH]

  Changed 6 years ago by allison

  • summary changed from Fixed a few warnings and a NCI example on Windows using MSVS to [CAGE] Fixed a few warnings and a NCI example on Windows using MSVS
  • type changed from bug to cage
  • milestone 1.0 deleted

Thanks, the unused variable and NCI example fixes applied in r37420, r37421, and r37422. Other changes held for review after 1.0.

  Changed 6 years ago by rurban

I have more msvc warnings. Two look important:

src/thread.c(503): Parrot_Interp  interp = (Parrot_Interp)VTABLE_get_pointer(interp, self); 
'interp' used without having been initialized

and here we miss an explicit double => long cast:

--- src/key.c   (revision 37431)
+++ src/key.c   (working copy)
@@ -341,10 +341,10 @@
             return REG_INT(interp, int_key);

         case KEY_number_FLAG:
-            return PMC_num_val(key);
+            return (INTVAL)PMC_num_val(key);
         case KEY_number_FLAG | KEY_register_FLAG:
             GETATTR_Key_int_key(interp, key, int_key);
-            return REG_NUM(interp, int_key);
+            return (INTVAL)REG_NUM(interp, int_key);

         case KEY_pmc_FLAG | KEY_register_FLAG:
             {

  Changed 6 years ago by rurban

src/key.c fixed with r37454

cotto is working on src/threads.c:503

follow-up: ↓ 5   Changed 6 years ago by cotto

The uninitialized interp bug is fixed in r37502.

in reply to: ↑ 4   Changed 5 years ago by jkeenan

Replying to cotto:

The uninitialized interp bug is fixed in r37502.

cotto,

Can you appraise where this ticket stands?

Thank you very much.
kid51

  Changed 4 years ago by coke

  • owner set to cotto
Note: See TracTickets for help on using tickets.