[nem-bug] [Nemerle 0000837]: Warning N649 doesn't take into account static extern functions

feedback at nemerle.org feedback at nemerle.org
Fri Jan 26 16:15:18 CET 2007


A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=837> 
======================================================================
Reported By:                Evin Robertson
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   837
Category:                   Compiler
Reproducibility:            always
Severity:                   trivial
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             01-26-2007 14:48 CET
Last Modified:              01-26-2007 16:15 CET
======================================================================
Summary:                    Warning N649 doesn't take into account static extern
functions
Description: 
For the following code:

using System.Runtime.InteropServices;

public class A {
    [StructLayout(LayoutKind.Sequential)]
    private struct S {
        public a : int;
        public b : int;
    }

    [DllImport("libf.so")]
    private static extern F(s : out S) : void;

    public G() : int {
        mutable s;
        F(out s);
        s.a + s.b;
    }
}

nemerle reports the following warnings:

ExternUsed.n:6:9:6:23: warning: N649: field `A.S.a' is never assigned to,
and will always have its default value
ExternUsed.n:7:9:7:23: warning: N649: field `A.S.b' is never assigned to,
and will always have its default value


These fields will be assigned by the call to F.

======================================================================

----------------------------------------------------------------------
 nazgul - 01-26-07 14:55 
----------------------------------------------------------------------
Well.. as it is external function, we have no way to know what is does. As
way to workaround it is to used #pragma directive around the struct to
disable the warning.

----------------------------------------------------------------------
 malekith - 01-26-07 16:15 
----------------------------------------------------------------------
It takes it as an out parameter, therefore we should assume all the fields
are being assigned to. I guess at least.

Patches are welcome :-)

Issue History
Date Modified  Username       Field                    Change              
======================================================================
01-26-07 14:48 Evin Robertson New Issue                                    
01-26-07 14:55 nazgul         Note Added: 0001640                          
01-26-07 16:15 malekith       Note Added: 0001641                          
======================================================================




More information about the bugs mailing list