Menu ▾ ▴

#526 format wrongly if function name has "construct"

closed-fixed
None
2023-05-19
2019-05-13
wuzhouhui
No

Hi,

I have found that the astyle will format code wrongly. The code snippet is:

static struct spdk_opal_key *
opal_construct_key(const char *passwd)
{
        return opal_key;
}

But

astyle --options=.astylerc a.c

will format previous code snippet to:

static struct spdk_opal_key *
        opal_construct_key(const char *passwd)
{
        return opal_key;
}

If I rename opal_construct_key to opal_create_key, then astyle will not format code.

Is it a bug?

astyle version: 3.1
Contents of .astylerc:

# Bracket Style
style=kr # K&R brackets
j # Add braces to one-line conditional statements
keep-one-line-blocks # Don't break blocks that are on one line

# Indentation
indent=force-tab=8 # Use tabs for indentation, spaces for minor alignment
min-conditional-indent=0

# Padding
unpad-paren # Remove all spaces with parens that aren't requested below
pad-oper # Put spaces around operators
pad-header # Put spaces between if/while/for etc. and the first paren

# Pointers
align-pointer=name # Align the * next to the variable name

# Line wrapping
max-code-length=100 # 100 character line limit
break-after-logical # For if statements, wrap to the next line after logical operator

# Line endings
lineend=linux # LF line endings

# General options
suffix=none
formatted

Discussion

  • André Simon

    André Simon - 2023-02-05
    • status: open --> open-accepted
    • assigned_to: André Simon
     
  • André Simon

    André Simon - 2023-04-16
    • status: open-accepted --> open-fixed
     
  • André Simon

    André Simon - 2023-04-16

    This was fixed in 3.3-beta1.

     
  • André Simon

    André Simon - 2023-05-19
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.