forked from premiere/premiere-libtorrent
detect cases where TORRENT_EXPORT is placed where gen_reference_doc.py ignores it, and fix the code
This commit is contained in:
parent
5c533522cb
commit
049b090e8d
|
@ -32,6 +32,8 @@ overviews = {}
|
||||||
# maps names -> URL
|
# maps names -> URL
|
||||||
symbols = {}
|
symbols = {}
|
||||||
|
|
||||||
|
global orphaned_export
|
||||||
|
|
||||||
# some files that need pre-processing to turn symbols into
|
# some files that need pre-processing to turn symbols into
|
||||||
# links into the reference documentation
|
# links into the reference documentation
|
||||||
preprocess_rst = \
|
preprocess_rst = \
|
||||||
|
@ -243,6 +245,9 @@ def parse_function(lno, lines, filename):
|
||||||
end_paren = 0
|
end_paren = 0
|
||||||
signature = ''
|
signature = ''
|
||||||
|
|
||||||
|
global orphaned_export
|
||||||
|
orphaned_export = False
|
||||||
|
|
||||||
while lno < len(lines):
|
while lno < len(lines):
|
||||||
l = lines[lno].strip()
|
l = lines[lno].strip()
|
||||||
lno += 1
|
lno += 1
|
||||||
|
@ -309,6 +314,8 @@ def parse_class(lno, lines, filename):
|
||||||
decl = decl.replace('TORRENT_FINAL', 'final')
|
decl = decl.replace('TORRENT_FINAL', 'final')
|
||||||
name = decl.split(':')[0].replace('class ', '').replace('struct ', '').replace('final', '').strip()
|
name = decl.split(':')[0].replace('class ', '').replace('struct ', '').replace('final', '').strip()
|
||||||
|
|
||||||
|
global orphaned_export
|
||||||
|
orphaned_export = False
|
||||||
|
|
||||||
while lno < len(lines):
|
while lno < len(lines):
|
||||||
l = lines[lno].strip()
|
l = lines[lno].strip()
|
||||||
|
@ -609,7 +616,14 @@ for filename in files:
|
||||||
|
|
||||||
blanks = 0
|
blanks = 0
|
||||||
lno = 0
|
lno = 0
|
||||||
|
global orphaned_export
|
||||||
|
orphaned_export = False
|
||||||
|
|
||||||
while lno < len(lines):
|
while lno < len(lines):
|
||||||
|
if orphaned_export:
|
||||||
|
print('ERROR: TORRENT_EXPORT without function or class!\n%s:%d\n%s' % (filename, lno, l))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
l = lines[lno].strip()
|
l = lines[lno].strip()
|
||||||
lno += 1
|
lno += 1
|
||||||
|
|
||||||
|
@ -618,6 +632,15 @@ for filename in files:
|
||||||
context = ''
|
context = ''
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if 'TORRENT_EXPORT' in l.split() \
|
||||||
|
and not 'ifndef TORRENT_EXPORT' in l \
|
||||||
|
and not 'define TORRENT_DEPRECATED_EXPORT TORRENT_EXPORT' in l \
|
||||||
|
and not 'define TORRENT_EXPORT' in l \
|
||||||
|
and not 'for TORRENT_EXPORT' in l \
|
||||||
|
and not 'TORRENT_EXPORT TORRENT_CFG' in l:
|
||||||
|
orphaned_export = True;
|
||||||
|
if verbose: print 'maybe orphaned: %s\n' % l
|
||||||
|
|
||||||
if l.startswith('//') and l[2:].strip() == 'OVERVIEW':
|
if l.startswith('//') and l[2:].strip() == 'OVERVIEW':
|
||||||
# this is a section overview
|
# this is a section overview
|
||||||
current_overview = ''
|
current_overview = ''
|
||||||
|
|
|
@ -101,7 +101,7 @@ namespace libtorrent {
|
||||||
TORRENT_EXPORT boost::system::error_category& bdecode_category();
|
TORRENT_EXPORT boost::system::error_category& bdecode_category();
|
||||||
|
|
||||||
#ifndef TORRENT_NO_DEPRECATED
|
#ifndef TORRENT_NO_DEPRECATED
|
||||||
TORRENT_DEPRECATED TORRENT_EXPORT
|
TORRENT_DEPRECATED_EXPORT
|
||||||
boost::system::error_category& get_bdecode_category();
|
boost::system::error_category& get_bdecode_category();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,8 @@ namespace libtorrent
|
||||||
|
|
||||||
// This function parses out information from the magnet link and populates the
|
// This function parses out information from the magnet link and populates the
|
||||||
// add_torrent_params object.
|
// add_torrent_params object.
|
||||||
TORRENT_EXPORT
|
TORRENT_EXPORT void parse_magnet_uri(std::string const& uri
|
||||||
void parse_magnet_uri(std::string const& uri, add_torrent_params& p, error_code& ec);
|
, add_torrent_params& p, error_code& ec);
|
||||||
|
|
||||||
// internal, delete when merge in master
|
// internal, delete when merge in master
|
||||||
TORRENT_EXTRA_EXPORT
|
TORRENT_EXTRA_EXPORT
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace libtorrent
|
||||||
TORRENT_EXPORT boost::system::error_category& upnp_category();
|
TORRENT_EXPORT boost::system::error_category& upnp_category();
|
||||||
|
|
||||||
#ifndef TORRENT_NO_DEPRECATED
|
#ifndef TORRENT_NO_DEPRECATED
|
||||||
TORRENT_DEPRECATED TORRENT_EXPORT
|
TORRENT_DEPRECATED_EXPORT
|
||||||
boost::system::error_category& get_upnp_category();
|
boost::system::error_category& get_upnp_category();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue