Coder Social home page Coder Social logo

cnorm's People

Contributors

lionelauroux avatar payet-s avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cnorm's Issues

Function pointers and wrapped-with-parenthesis variables

CNORM does not identify the differences between function pointers and wrapped-with-parenthesis variables.

For an: int (*lol);

 type=Decl:
    _ctype type=PrimaryType:
        _decltype type=PointerType:
            _decltype type=ParenType:
                _decltype
                _params type=list:

        _identifier str='int'
        _specifier int=0
        _storage int=0
    _name str='lol'

For an: int (*fptr)();

 type=Decl:
    _ctype type=PrimaryType:
        _decltype type=PointerType:
            _decltype type=ParenType:
                _decltype
                _params type=list:

        _identifier str='int'
        _specifier int=0
        _storage int=0
    _name str='fptr'

Moreover, when we use the "to_c()" method with those Decls, CNORM only gives us wrapped-with-parenthesis variables.

int (*lol);
int (*fptr);

Thank you :)

String literal concatenation

According to the C standards, successive string literals are interpreted as one string, composed of all the strings concatenated (i.e. printf("Hello " "world !"); is the same as printf("Hello world !").
Pyrser raises an exception with this syntax, even though it is valid.

Identifier for var type not filled

struct test
{
  int i;
};

struct test * var1;
struct test const * var2;

The type identifier for the variable "var2" is not filled in this case.

            [ 1 ] type=Decl:
                _ctype type=ComposedType:
                    _decltype type=PointerType:
                        _decltype
                    _identifier str='test'
                    _specifier int=1
                    _storage int=0
                _name str='var1'
            [ 2 ] type=Decl:
                _ctype type=ComposedType:
                    _decltype type=PointerType:
                        _decltype
                    _identifier str=''
                    _specifier int=1
                    _storage int=0
                _name str='var2'

Storage qualifier broken for structs

struct test
{
  int i;
};

int main()
{

  register const struct test const var1;
}

gives

[ 0 ] type=Decl:
       _ctype type=ComposedType:
       _decltype
       _identifier str='var1'
       _specifier int=1
       _storage int=1
       _name str=''

Cnorm doesn't detect any qualifier, and in this case the type identifier is set to "var1"
Globaly, all qualifiers for structs type doesn't apply.

Storage qualifiers conflict with each other

A function cannot be static and inline at the same time for CNorm. When it is, the last qualifier is taken.
Ex:

inline static int f() {}
static inline int f() {}

gives this when it is parsed by Declaration and transformed into C:

static int f() {}
inline int f() {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.