Skip to content

Commit 634c7aa

Browse files
committed
[sipify] fix do not print comment after SIP directive
1 parent 1f8c311 commit 634c7aa

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

scripts/sipify.pl

+5-1
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,11 @@ sub remove_constructor_or_body {
659659
$is_override = 0;
660660
next;
661661
}
662-
elsif ( $line =~ m/\/\// || $line =~ m/\s*typedef / || $line =~ m/\s*struct / || $line =~ m/operator\[\]\(/ ){
662+
elsif ( $line =~ m/\/\// ||
663+
$line =~ m/\s*typedef / ||
664+
$line =~ m/\s*struct / ||
665+
$line =~ m/operator\[\]\(/ ||
666+
$line =~ m/^\s*% \w+(.*)?$/ ){
663667
dbg_info('skipping comment');
664668
$comment = '';
665669
$return_type = '';

tests/scripts/sipifyheader.expected.sip

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99

1010

1111

12+
% ModuleHeaderCode
13+
#include <qgsnetworkspeedstrategy.h>
14+
#include <qgsnetworkdistancestrategy.h>
15+
%End
16+
17+
18+
19+
1220

1321

1422

tests/scripts/sipifyheader.h

+10
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ email : denis.rouzaud@gmail.com
1616
#ifndef SIPIFYHEADER_H
1717
#define SIPIFYHEADER_H
1818

19+
1920
#include "qgis_core.h"
2021
#include <QtClass>
2122

23+
#ifdef SIP_RUN
24+
% ModuleHeaderCode
25+
#include <qgsnetworkspeedstrategy.h>
26+
#include <qgsnetworkdistancestrategy.h>
27+
% End
28+
#endif
29+
2230
#include "sipifyheader.h"
2331

2432
// one shall include qgis.h to use SIP annotations
@@ -27,6 +35,8 @@ email : denis.rouzaud@gmail.com
2735
class QgsForwardDeclaration;
2836

2937

38+
39+
3040
/***************************************************************************
3141
* This is some random block comment that will not be displayed.
3242
* Block comments shall will placed upon class, method, enum without

0 commit comments

Comments
 (0)