handle __attribute__
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5948 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -31,14 +31,14 @@ while(<>) {
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if(/\{/){
|
if(/\{/){
|
||||||
|
$_ = $line;
|
||||||
|
while(s/\*\//\ca/){
|
||||||
|
s/\/\*(.|\n)*\ca//;
|
||||||
|
}
|
||||||
|
s/^\s*//;
|
||||||
|
s/\s$//;
|
||||||
|
s/\s+/ /g;
|
||||||
if($line =~ /\)\s$/){
|
if($line =~ /\)\s$/){
|
||||||
$_ = $line;
|
|
||||||
while(s/\*\//\ca/){
|
|
||||||
s/\/\*(.|\n)*\ca//;
|
|
||||||
}
|
|
||||||
s/^\s*//;
|
|
||||||
s/\s$//;
|
|
||||||
s/\s+/ /g;
|
|
||||||
if(!/^static/ && !/^PRIVATE/){
|
if(!/^static/ && !/^PRIVATE/){
|
||||||
# remove outer ()
|
# remove outer ()
|
||||||
s/\s*\(/@/;
|
s/\s*\(/@/;
|
||||||
@@ -52,15 +52,19 @@ while(<>) {
|
|||||||
/([a-zA-Z0-9_]+)\s*@/;
|
/([a-zA-Z0-9_]+)\s*@/;
|
||||||
$f = $1;
|
$f = $1;
|
||||||
# only add newline if more than one parameter
|
# only add newline if more than one parameter
|
||||||
|
$LP = "(("; # XXX workaround for indentation bug in emacs
|
||||||
|
$RP = "))";
|
||||||
|
$P = "__P((";
|
||||||
if(/,/){
|
if(/,/){
|
||||||
s/@/ __P((\n\t/;
|
s/@/ __P$LP\n\t/;
|
||||||
}else{
|
}else{
|
||||||
s/@/ __P((/;
|
s/@/ __P$LP/;
|
||||||
}
|
}
|
||||||
s/@/))/;
|
s/@/$RP/;
|
||||||
$_ = $_ . ";";
|
$_ = $_ . ";";
|
||||||
# insert newline before function name
|
# insert newline before function name
|
||||||
s/(.*)\s([a-zA-Z0-9_]+ __P)/$1\n$2/;
|
s/(.*)\s([a-zA-Z0-9_]+ __P)/$1\n$2/;
|
||||||
|
s/(.*)\s(__attribute__.*)/$1\n\t$2/;
|
||||||
$funcs{$f} = $_;
|
$funcs{$f} = $_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,11 +145,33 @@ foreach(sort keys %funcs){
|
|||||||
if(/^(main)$/) { next }
|
if(/^(main)$/) { next }
|
||||||
if(/^_/) {
|
if(/^_/) {
|
||||||
$private_h .= $funcs{$_} . "\n\n";
|
$private_h .= $funcs{$_} . "\n\n";
|
||||||
|
if($funcs{$_} =~ /__attribute__/) {
|
||||||
|
$private_attribute_seen = 1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$public_h .= $funcs{$_} . "\n\n";
|
$public_h .= $funcs{$_} . "\n\n";
|
||||||
|
if($funcs{$_} =~ /__attribute__/) {
|
||||||
|
$public_attribute_seen = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($public_attribute_seen) {
|
||||||
|
$public_h_header .= "#if !defined(__GNUC__) && !defined(__attribute__)
|
||||||
|
#define __attribute__(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($private_attribute_seen) {
|
||||||
|
$private_h_header .= "#if !defined(__GNUC__) && !defined(__attribute__)
|
||||||
|
#define __attribute__(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($public_h ne "") {
|
if ($public_h ne "") {
|
||||||
$public_h = $public_h_header . $public_h . "#endif /* $block */\n";
|
$public_h = $public_h_header . $public_h . "#endif /* $block */\n";
|
||||||
|
Reference in New Issue
Block a user