Woodrow Douglass
Woodrow Douglass

Reputation: 2655

Astyle code formatting

I'm writing a linux kernel module, and trying to use astyle to help me follow the coding standard. It seems to be formatting a spi_driver structure incorrectly and I'm wondering if anyone knows why. This is the code before passing to astyle (with the command astyle --style=linux lightmod.c):

static struct spi_driver light_driver = {
    .driver = {
            .name = "light",
            .owner = THIS_MODULE,
    },
    .probe = light_probe,
    .remove = __devexit_p(light_remove),
};

And this is the output:

static struct spi_driver light_driver = {
    .driver = {
            .name = "light",
            .owner = THIS_MODULE,
    },
    .probe = light_probe,
             .remove = __devexit_p(light_remove),
               };

Why is it indenting .remove this way? Does anyone know?

Upvotes: 2

Views: 4164

Answers (1)

Jens Gustedt
Jens Gustedt

Reputation: 79003

I don't think that there is a deep reason for this. Astyle simply seems not be able to handle C99's designated initializers correctly. If you use oldstyle initializers it formats them fine.

Upvotes: 1

Related Questions