Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrate sorting of includes into astyle.sh/astyle-all.sh/prepare-co…
…mmit.sh
- Loading branch information
Showing
3 changed files
with
81 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/perl -i.sortinc -n | ||
########################################################################### | ||
# sort_includes.pl | ||
# --------------------- | ||
# begin : June 2015 | ||
# copyright : (C) 2015 by Juergen E. Fischer | ||
# email : jef at norbit dot de | ||
# | ||
########################################################################### | ||
# # | ||
# This program is free software; you can redistribute it and/or modify # | ||
# it under the terms of the GNU General Public License as published by # | ||
# the Free Software Foundation; either version 2 of the License, or # | ||
# (at your option) any later version. # | ||
# # | ||
########################################################################### | ||
|
||
# adapted from scripts/sort_includes.sh | ||
|
||
use strict; | ||
use warnings; | ||
|
||
our %uis; | ||
our %sys; | ||
our %others; | ||
our $sorting; | ||
|
||
BEGIN { $sorting = 0; } | ||
END { die "header files not empty" if keys %uis || keys %sys || keys %others; } | ||
|
||
if(/^\s*#include/ ) { | ||
if(/"ui_/ ) { | ||
$uis{$_}=1; | ||
} elsif(/</) { | ||
$sys{$_}=1; | ||
} else { | ||
$others{$_}=1; | ||
} | ||
$sorting=1; | ||
next; | ||
} | ||
|
||
if( $sorting ) { | ||
print foreach sort keys %uis; | ||
print foreach sort keys %sys; | ||
print foreach sort keys %others; | ||
|
||
undef %uis; | ||
undef %sys; | ||
undef %others; | ||
} | ||
|
||
|
||
$sorting=0; | ||
|
||
print; |
facfe6e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure but if run on qgsofflineediting.cpp, it will put spatialiate.h before sqlite3.h and it will cause an error in compilation
facfe6e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this makes my script useless, right?
facfe6e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, I meanwhile changed it to just remove duplicate includes - that should be save - otherwise prepare-commit.sh or astyle-all.sh could break stuff.