Open MaJerle opened 2 years ago
@llvm/issue-subscribers-clang-format
Furthermore, there seems no consistency between formatting of different structures. Looks like random:
Using same configuration, and same format version, I get:
static const pp_can_cfg_t can_cfg_default = {.clk_presc = 4, /* Decrease input clock to 20 MHz */
.br_nominal =
{ /* Configure br nominal to 125 kHz */
.clk_presc = 8, /* Set nominal tq time to 2.5 MHz */
.swj = 1,
.ts1 = 16,
.ts2 = 3},
.br_data =
{ /* Configure br data to 1 MHz */
.clk_presc = 1, /* Set nominal tq time to 20 MHz */
.swj = 1,
.ts1 = 16,
.ts2 = 3},
.operation_mode = PP_CAN_OP_MODE_LOOPBACK_INTERNAL,
.flags = {
.fd = 1,
.brs = 1,
.auto_retransmission = 1,
.protocol_exception = 0,
.transmit_pause = 0,
.enable_termination = 0,
.start = 1,
}};
static const lwbg95_conn_connect_t connection_info_ssl = {
.type = LWBG95_CONN_TYPE_SSL,
.type_data = {.ssl = {
.cipher_suite = LWBG95_SSL_CIPHER_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
.ca_cert_path = TLS_CERTIFICATE_KEY_NAME,
.client_key_path = TLS_PRIVATE_KEY_NAME,
.negotiate_time = 300,
.sslversion = LWBG95_SSL_VERSION_ALL,
.sec_level = 0,
.ignore_ltime = 0,
}}};
See part br_nominal =
. Opening curly bracket is not in the same line as this is the case in the .ssl = {
in the second structure.
Is there an option to get JSON-like structure?
Like that
/* Very default FDCAN configuration - used when invalid parameter is used or during startup */
static const pp_can_cfg_t can_cfg_default = {
.clk_presc = 4, /* Decrease input clock to 20 MHz */
.br_nominal = { /* Configure br nominal to 125 kHz */
.clk_presc = 8, /* Set nominal tq time to 2.5 MHz */
.swj = 1,
.ts1 = 16,
.ts2 = 3},
.br_data = { /* Configure br data to 1 MHz */
.clk_presc = 1, /* Set nominal tq time to 20 MHz */
.swj = 1,
.ts1 = 16,
.ts2 = 3},
.operation_mode = PP_CAN_OP_MODE_LOOPBACK_INTERNAL,
.flags = {
.fd = 1,
.brs = 1,
.auto_retransmission = 1,
.protocol_exception = 0,
.transmit_pause = 0,
.enable_termination = 0,
.start = 1,
}
};
Original problem doesn't seem to exist in 16.0.0.
Second problem/question is related to array of structures initialization, and the number of nesting levels you have in the structures.
Second problem/question is related to array of structures initialization, and the number of nesting levels you have in the structures.
Is there a way to fix it?
I'm not certain. The Array of Structures support is complex and brittle.
This (original) code
is formatted as
Why only first one is in-line, while second one remains as-is? Even if I swap the var order, it will always format only
modem_thread_attr
variableFormat file