detect cases where TORRENT_EXPORT is placed where gen_reference_doc.py ignores it, and fix the code

This commit is contained in:
arvidn 2018-11-12 17:38:01 +01:00 committed by Arvid Norberg
parent 5c533522cb
commit 049b090e8d
4 changed files with 27 additions and 4 deletions

View File

@ -32,6 +32,8 @@ overviews = {}
# maps names -> URL
symbols = {}
global orphaned_export
# some files that need pre-processing to turn symbols into
# links into the reference documentation
preprocess_rst = \
@ -243,6 +245,9 @@ def parse_function(lno, lines, filename):
end_paren = 0
signature = ''
global orphaned_export
orphaned_export = False
while lno < len(lines):
l = lines[lno].strip()
lno += 1
@ -309,6 +314,8 @@ def parse_class(lno, lines, filename):
decl = decl.replace('TORRENT_FINAL', 'final')
name = decl.split(':')[0].replace('class ', '').replace('struct ', '').replace('final', '').strip()
global orphaned_export
orphaned_export = False
while lno < len(lines):
l = lines[lno].strip()
@ -609,7 +616,14 @@ for filename in files:
blanks = 0
lno = 0
global orphaned_export
orphaned_export = False
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()
lno += 1
@ -618,6 +632,15 @@ for filename in files:
context = ''
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':
# this is a section overview
current_overview = ''

View File

@ -101,7 +101,7 @@ namespace libtorrent {
TORRENT_EXPORT boost::system::error_category& bdecode_category();
#ifndef TORRENT_NO_DEPRECATED
TORRENT_DEPRECATED TORRENT_EXPORT
TORRENT_DEPRECATED_EXPORT
boost::system::error_category& get_bdecode_category();
#endif

View File

@ -77,8 +77,8 @@ namespace libtorrent
// This function parses out information from the magnet link and populates the
// add_torrent_params object.
TORRENT_EXPORT
void parse_magnet_uri(std::string const& uri, add_torrent_params& p, error_code& ec);
TORRENT_EXPORT void parse_magnet_uri(std::string const& uri
, add_torrent_params& p, error_code& ec);
// internal, delete when merge in master
TORRENT_EXTRA_EXPORT

View File

@ -97,7 +97,7 @@ namespace libtorrent
TORRENT_EXPORT boost::system::error_category& upnp_category();
#ifndef TORRENT_NO_DEPRECATED
TORRENT_DEPRECATED TORRENT_EXPORT
TORRENT_DEPRECATED_EXPORT
boost::system::error_category& get_upnp_category();
#endif