Skip to content

Compile errors with VisualStudio #713

Open
@Dave-Nocturnal

Description

@Dave-Nocturnal

I am trying to compile lfs with Microsoft Visual Studio C/C++ so I can support unit testing and debug of our embedded code. I get some rather obvious compiler errors. Am I missing something? How do other compilers accept this? Here is what I find:

    // next step, clean up orphans
    err = lfs_fs_preporphans(lfs, -hasparent);

The variable hasparent is declared as a local boolean. How can you make a boolean negative? This is a warning.

    info->type = lfs_tag_type3(tag);

The variable tag is an int32_t and this treats it as a in8_t. This is a warning

    return lfs_npw2((a & -a) + 1) - 1;

The variable a is passed in as a uint32_t. This code attempts to take the negative of an unsigned integer. This is a compile error. There are two places where this same pattern occurs.

I would think other compilers will have the same kinds of issues. Are these simply accepted as part of lfs? This is my first time building lfs so I am unsure of the current development state. I have heard good things about it from others but these warnings and errors are concerning and appear to be something all compilers would face.

....and yes, I do understand what the code in these examples is trying to do. It isn't that a compiler can't do these operations, my question is regarding the syntax used that does not seem to avoid warnings and errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions