We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 149d13d commit 876c700Copy full SHA for 876c700
src/tools/pgindent/pgindent
@@ -67,11 +67,14 @@ do
67
line2 = $0;
68
if (skips > 0)
69
skips--;
70
- if (line1 ~ "^extern[ ]*\"C\"" &&
71
- line2 ~ "^{[ ]*$")
+ if (line1 ~ "^#ifdef[ ]*__cplusplus" &&
+ line2 ~ "^extern[ ]*\"C\"[ ]*$")
72
{
73
- # do not print first line
74
- print "/* Open extern \"C\" */";
+ print line1;
+ print line2;
75
+ if (getline && $0 ~ /^{[ ]*$/)
76
+ print "/* Open extern \"C\" */";
77
+ else print $0;
78
line2 = "";
79
skips = 2;
80
}
@@ -1490,8 +1493,7 @@ do
1490
1493
# remove tabs and retab with four spaces
1491
1494
detab -t8 -qc |
1492
1495
entab -t4 -qc |
- sed 's;^/\* Open extern \"C\" \*/$;extern "C"\
-{;' |
1496
+ sed 's;^/\* Open extern \"C\" \*/$;{;' |
1497
sed 's;^/\* Close extern \"C\" \*/$;};' |
1498
sed 's;/\*---X_X;/* ---;g' |
1499
# workaround indent bug
0 commit comments