Commit 07d8a2e
Fix: close the access-control regions that ran to end of file
Sixteen test files opened `#define private public` (usually `#define protected
public` too) and never closed it, so from the include block onwards the whole
translation unit compiled with `private` and `protected` meaning `public` -- up to
1016 lines in `charge_mixing_test.cpp`. `elecstate_pw_test.cpp` was a partial case:
it closed `protected` 318 lines later at the end of the file, and never closed
`private` at all.
Each `#undef` now sits immediately after the include block it is meant to cover.
No include is moved: in every one of these files the standard headers already came
after the project headers, so they simply fall outside the region once it is
closed. That removes the incidental treatment of `<omp.h>` (charge_mixing_test),
`<string>` (elecstate_energy_test), `<fstream>` (verlet_test), `<mpi.h>` and
`<source_base/module_external/scalapack_connector.h>` (propagator_test1/2/3),
`<source_base/macros.h>` (test_hsolver) and `"mpi.h"` (read_wf2rho_pw_test).
Closing a region early is safe: the class definitions the tests reach into have
already been compiled by the time the `#undef` is seen.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent a8e5e9a commit 07d8a2e
16 files changed
Lines changed: 27 additions & 1 deletion
File tree
- source
- source_esolver/test
- source_estate/test
- source_hsolver/test
- source_io/test
- source_lcao/module_rt/test
- source_md/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
323 | 325 | | |
324 | 326 | | |
325 | 327 | | |
326 | | - | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
0 commit comments