<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Configure the alignment/formatting of macros"
href="https://llvm.org/bugs/show_bug.cgi?id=25708">25708</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Configure the alignment/formatting of macros
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Formatter
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>gonzalobg88@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>AFAIK there are no current ways of configure the alginment/formatting of
macros.
I would like to be able to configure the alignment of macros.
For example, consider the current situation:
void foo() {
#ifdef BAR
do_something();
#endif
#pragma omp target data map ...
{
#pragma omp target ...
#pragma omp teams ...
#pragma omp distribute
for (int i = 0; i < size; i += num_blocks) {
#pragma omp parallel for
for (int j = i; j < i + num_blocks; ++j) {
y[i] = a * x[i] + y[i];
}
}
}
}
This looks horrible _to me_. I would very much prefer:
- macros to be indented as normal code,
- for #ifdef ... endif blocks to span its own "scope of indentation"
resulting in:
void foo() {
#ifdef BAR
do_something(); // see indentation here
#endif
#pragma omp target data map ...
{
#pragma omp target ...
#pragma omp teams ...
#pragma omp distribute
for (int i = 0; i < size; i += num_blocks) {
#pragma omp parallel for
for (int j = i; j < i + num_blocks; ++j) {
y[i] = a * x[i] + y[i];
}
}
}
}
which looks much better _to me_. It would be nice if there was an option (or
multiple) to switch between both styles (and maybe others like leaving the # at
the beginning of the line but indenting the body of the macro). In particular
since I work on some code bases that follow this style and which clang-format
currently "destroys".</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>