Skip to content

Commit 6cd4ccc

Browse files
Emil DotchevskiEmil Dotchevski
Emil Dotchevski
authored and
Emil Dotchevski
committed
Fixing bug on MSVC, unbalanced pragma push/pop. Improved leaf.hpp generation.
1 parent b88ecf9 commit 6cd4ccc

19 files changed

+335
-555
lines changed

LICENSE renamed to LICENSE_1_0.txt

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
Boost Software License - Version 1.0 - August 17th, 2003
2-
3-
Permission is hereby granted, free of charge, to any person or organization
4-
obtaining a copy of the software and accompanying documentation covered by
5-
this license (the "Software") to use, reproduce, display, distribute,
6-
execute, and transmit the Software, and to prepare derivative works of the
7-
Software, and to permit third-parties to whom the Software is furnished to
8-
do so, all subject to the following:
9-
10-
The copyright notices in the Software and this entire statement, including
11-
the above license grant, this restriction and the following disclaimer,
12-
must be included in all copies of the Software, in whole or in part, and
13-
all derivative works of the Software, unless such copies or derivative
14-
works are solely in the form of machine-executable object code generated by
15-
a source language processor.
16-
17-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19-
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20-
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21-
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23-
DEALINGS IN THE SOFTWARE.
1+
Boost Software License - Version 1.0 - August 17th, 2003
2+
3+
Permission is hereby granted, free of charge, to any person or organization
4+
obtaining a copy of the software and accompanying documentation covered by
5+
this license (the "Software") to use, reproduce, display, distribute,
6+
execute, and transmit the Software, and to prepare derivative works of the
7+
Software, and to permit third-parties to whom the Software is furnished to
8+
do so, all subject to the following:
9+
10+
The copyright notices in the Software and this entire statement, including
11+
the above license grant, this restriction and the following disclaimer,
12+
must be included in all copies of the Software, in whole or in part, and
13+
all derivative works of the Software, unless such copies or derivative
14+
works are solely in the form of machine-executable object code generated by
15+
a source language processor.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+
DEALINGS IN THE SOFTWARE.

gen/generate_single_header.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929

3030
def append(input_file_name, input_file, output_file, regex_includes, include_folder):
3131
line_count = 1
32+
last_line_was_empty = False
3233
for line in input_file:
33-
result = regex_includes.search(line)
3434
line_count += 1
35+
this_line_is_empty = (line=='\n')
36+
result = regex_includes.search(line)
3537
if result:
3638
next_input_file_name = result.group("include")
3739
if next_input_file_name not in included:
@@ -40,9 +42,15 @@ def append(input_file_name, input_file, output_file, regex_includes, include_fol
4042
with open(os.path.join(include_folder, next_input_file_name), "r") as next_input_file:
4143
output_file.write('// >>> %s#line 1 "%s"\n' % (line, next_input_file_name))
4244
append(next_input_file_name, next_input_file, output_file, regex_includes, include_folder)
43-
output_file.write('// <<< %s#line %d "%s"\n' % (line, line_count, input_file_name))
45+
if not ('include/boost/leaf/detail/all.hpp' in input_file_name):
46+
output_file.write('// <<< %s#line %d "%s"\n' % (line, line_count, input_file_name))
4447
else:
48+
if '///' in line:
49+
continue
50+
if this_line_is_empty and last_line_was_empty:
51+
continue
4552
output_file.write(line)
53+
last_line_was_empty = this_line_is_empty
4654

4755
def _main():
4856
parser = argparse.ArgumentParser(
@@ -60,7 +68,33 @@ def _main():
6068
regex_includes = re.compile(r"""^\s*#[\t\s]*include[\t\s]*("|\<)(?P<include>%s.*)("|\>)""" % args.prefix)
6169
print("Rebuilding %s:" % args.input)
6270
with open(args.output, 'w') as output_file, open(args.input, 'r') as input_file:
71+
output_file.write(
72+
'#ifndef BOOST_LEAF_HPP_INCLUDED\n'
73+
'#define BOOST_LEAF_HPP_INCLUDED\n'
74+
'\n'
75+
'// Copyright (c) 2018-2020 Emil Dotchevski and Reverge Studios, Inc.\n'
76+
'\n'
77+
'// Distributed under the Boost Software License, Version 1.0. (See accompanying\n'
78+
'// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n'
79+
'\n'
80+
'#ifndef BOOST_LEAF_ENABLE_WARNINGS\n'
81+
'# if defined(_MSC_VER)\n'
82+
'# pragma warning(push,1)\n'
83+
'# elif defined(__clang__)\n'
84+
'# pragma clang system_header\n'
85+
'# elif (__GNUC__*100+__GNUC_MINOR__>301)\n'
86+
'# pragma GCC system_header\n'
87+
'# endif\n'
88+
'#endif\n'
89+
'\n' )
6390
append(args.input, input_file, output_file, regex_includes, args.path)
91+
output_file.write(
92+
'\n'
93+
'#if defined(_MSC_VER) && !defined(BOOST_LEAF_ENABLE_WARNINGS)\n'
94+
'#pragma warning(pop)\n'
95+
'#endif\n'
96+
'\n'
97+
'#endif\n' )
6498

6599
if __name__ == "__main__":
66100
_main()

0 commit comments

Comments
 (0)