Skip to content

C: The 3 expressions within a for loop do not align together on the three separate lines #1081

Closed

Description

@andrewhit

Today I downloaded the latest uncrustify package and installed on my Linux VM.

Here is the link to the 4 files, debug.files, ngx_http.c (the orignal), ngx_http.c.unc(the generated result) and ngx_http.c.exp(the expected result).

4 files
debug.txt
ngx_http.c
ngx_http.c.unc
ngx_http.c.exp

I have descried the issues within ngx_http.c.exp in detail.

Additionally there is no version info that was displayed.

azhuang@pek2-office-04-dhcp52:~/test$ uncrustify --version
uncrustify

Activity

  1. andrewhit commented on Apr 2, 2017

    @andrewhit
    Author

    Could you tell me what cmake command can be executed for your below statement?

    "CMake calls make_version.py which now can generate the following version string formats:"

  2. CDanU commented on Apr 2, 2017

    @CDanU
    Collaborator

    This is a fix for:

    Additionally there is no version info that was displayed.
    azhuang@pek2-office-04-dhcp52:~/test$ uncrustify --version
    uncrustify

    When the referenced commit is merged, building Uncrustify the usual way (inside uncrsutify/build, cmake .. && make && make test) will call make_version.py which generates a propper version string.
    If you want to you can just manually call make_version.py and it will print out the version string.

  3. andrewhit commented on Apr 2, 2017

    @andrewhit
    Author

    azhuang@pek2-office-04-dhcp52:~/tmp/uncrustify$ ./scripts/make_version.py
    current: 0.64.547-g4fdddba
    release: 0.64

  4. andrewhit commented on Apr 2, 2017

    @andrewhit
    Author

    Previously I downloaded uncrustify zip file directly so there is no .git file and no version info output when executing # uncrustify --version.

    After checking make_version.py, I have to use git clone to download and .git exists under uncrustify directory. And # uncrustify --version works fine.

    azhuang@pek2-office-04-dhcp52:~/test$ uncrustify --version
    uncrustify 0.64.547-g4fdddba

  5. CDanU commented on Apr 2, 2017

    @CDanU
    Collaborator

    Yes I did not thought about this, and personally I too think that this is a big drawback so I am closing that PR for now.

  6. andrewhit commented on Apr 5, 2017

    @andrewhit
    Author

    @CDanU Please do not close this bug and I have verified and closed the bug of "uncrustify -c config".

    Also please check ngx_http.c.exp within which I have described some other issue and several enhancement requests.

  7. CDanU commented on Apr 5, 2017

    @CDanU
    Collaborator

    I meant the PR I had done, this issue here stays open
    (as contributor I don't have the rights for that anyways).

    It would however be nice if you could instead of putting everything in the files you linked, open a new issue for every issue and feature request that you have, with nice markdown formatting and all that stuff and then close this issue yourself after you have done that.

  8. andrewhit commented on Apr 5, 2017

    @andrewhit
    Author

    Okay. I will use this PR to describe the 1st issue.

    Line 641 of ngx_http.c

        for (q = ngx_queue_head(locations);
             q != ngx_queue_sentinel(locations);
             q = ngx_queue_next(q))
        {

    becomes line 639 of ngx_http.c.unc after uncrustification

        for (q = ngx_queue_head(locations);
            q != ngx_queue_sentinel(locations);
            q = ngx_queue_next(q))                          
    {

    It was observed the 2nd and 3rd lines do not align with the 1st line within ngx_http.c.unc. And these 3 lines are expected to be aligned together.

  9. changed the title [-]The 3 expressions within a for loop do not align together on the three separate lines[/-] [+]C: The 3 expressions within a for loop do not align together on the three separate lines[/+] on Apr 5, 2017
  10. CDanU commented on Apr 5, 2017

    @CDanU
    Collaborator

    This one is also caused (no bug) by:

    # The continuation indent. If non-zero, this overrides the indent of '(' 
    # and '=' continuation indents. For FreeBSD, this is set to 4. Negative 
    # value is absolute and not increased for each ( level
    indent_continue                 = 4        # number
  11. andrewhit commented on Apr 6, 2017

    @andrewhit
    Author

    Many Thanks!

    Originally "indent_continue=4" is set to make the function definitions and prototypes use one indentation level. Now I changed it as below and the issue is gone.

    indent_continue          = 0
    
    # True:  indent continued function call parameters one indent level
    # False: align parameters under the open paren
    indent_func_call_param   = false    # false/true
    
    # Same as indent_func_call_param, but for function defs
    indent_func_def_param    = true    # false/true
    
    # Same as indent_func_call_param, but for function protos
    indent_func_proto_param  = true    # false/true
    
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions