Skip to content

align_var_def_star_style and align_var_def_amp_style ignored #1074

Closed

Description

@Massimo-B

Hi, switching these 2 options doesn't make a difference:

# How to align the star in variable definitions.
#  0=Part of the type     'void *   foo;'
#  1=Part of the variable 'void     *foo;'
#  2=Dangling             'void    *foo;'
align_var_def_star_style        = 2        # unsigned number
# How to align the '&' in variable definitions.
#  0=Part of the type
#  1=Part of the variable
#  2=Dangling
align_var_def_amp_style         = 2        # unsigned number

So setting both to 2 this works as expected:

(cfg="https://bitbucket.org/massimo/test/raw/61a0b91ee51726239c87566467f3935fb38b41a5/crusty-test_011.cfg" ; input="https://bitbucket.org/massimo/test/raw/61a0b91ee51726239c87566467f3935fb38b41a5/crusty-test_011.h" ; uncrustify -v ; curl -s "$input" ; curl -s "$input" | uncrustify -l cpp -c <(curl -s "$cfg") )
uncrustify 0.64_d

class MyClass
{
    public:
        MyClass ( const QString &_message );
        QMainWindow     *mainWindow;
        const char*     tag;
};

Parsing: 144 bytes (144 chars) from stdin as language CPP
class MyClass
{
public:
    MyClass(const QString &_message);
    QMainWindow *mainWindow;
    const char  *tag;
};

Changing both options to 0, the result is different but not as expected and not consistent:

(cfg="https://bitbucket.org/massimo/test/raw/d9fd68158db1e88315cc0bbe5907fcccd266e2f0/crusty-test_011.cfg" ; input="https://bitbucket.org/massimo/test/raw/61a0b91ee51726239c87566467f3935fb38b41a5/crusty-test_011.h" ; uncrustify -v ; curl -s "$input" ; curl -s "$input" | uncrustify -l cpp -c <(curl -s "$cfg") )
uncrustify 0.64_d

class MyClass
{
    public:
        MyClass ( const QString &_message );
        QMainWindow     *mainWindow;
        const char*     tag;
};

Parsing: 144 bytes (144 chars) from stdin as language CPP

class MyClass
{
public:
MyClass ( const QString &_message );
QMainWindow     *mainWindow;
const char*     tag;
};

My current build is from

*   commit de474b8 (HEAD -> master, origin/master, origin/HEAD)

PS.: Please add some git revision to dev builds with uncrustify -v.

Activity

  1. CDanU commented on Mar 29, 2017

    @CDanU
    Collaborator

    It might be that the descriptions of the options are wrong.
    Both option values are mapped to this enum:

       enum StarStyle
       {
          SS_IGNORE,  // don't look for prev stars
          SS_INCLUDE, // include prev * before add
          SS_DANGLE   // include prev * after add
       };
  2. Massimo-B commented on Mar 30, 2017

    @Massimo-B
    Author

    No, settings both to 1 is the same result as with value 2:

    (cfg="https://bitbucket.org/massimo/test/raw/81e92c0ea40d4972404dcd8d0e794f7865bd66cf/crusty-test_011.cfg" ; input="https://bitbucket.org/massimo/test/raw/61a0b91ee51726239c87566467f3935fb38b41a5/crusty-test_011.h" ; uncrustify -v ; curl -s "$input" ; curl -s "$input" | uncrustify -l cpp -c <(curl -s "$cfg") )
    uncrustify 0.64_d
    
    class MyClass
    {
        public:
            MyClass ( const QString &_message );
            QMainWindow     *mainWindow;
            const char*     tag;
    };
    
    Parsing: 144 bytes (144 chars) from stdin as language CPP
    class MyClass
    {
    public:
        MyClass(const QString &_message);
        QMainWindow *mainWindow;
        const char  *tag;
    };
  3. guy-maurel commented on Apr 10, 2017

    @guy-maurel
    Contributor

    Please push your configuration file

  4. guy-maurel commented on Apr 10, 2017

    @guy-maurel
    Contributor

    Please add a declaration such as:

          int test;
            QMainWindow     *mainWindow;
            const char*                    tag;
    

    to see how it works.

  5. gmaurel commented on Oct 16, 2017

    @gmaurel
    Collaborator

    No answer --> I close the call.

  6. Massimo-B commented on Oct 17, 2017

    @Massimo-B
    Author

    With current uncrustify and both options to 0 it still does not work as expected:

    (cfg="https://bitbucket.org/massimo/test/raw/66fbb77094a399e759e32faceb18ab60bf8e5a07/crusty-test_011.cfg" ; inpu"https://bitbucket.org/massimo/test/raw/6813c1b5de48a8eaaadbaaf058daccb5a79c9b39/crusty-test_011.h" ; uncrustify -v ; curl -s "$input" ; curl -s "$input" | uncrustify -l cpp -c <(curl -s "$cfg") )
    Uncrustify-0.65-69-0f5a5577
    
    class MyClass
    {
        public:
            MyClass ( const QString &_message );
            
         int test;   
            QMainWindow     *mainWindow;
            const char*     tag;
    };
    
    Parsing: 171 bytes (171 chars) from stdin as language CPP
    class MyClass
    {
    public:
        MyClass(const QString &_message);
    
        int          test;
        QMainWindow *mainWindow;
        const char * tag;
    };
  7. added
    NoAnswer
    on Oct 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C and C++11NoAnswerwaiting_for_answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions