• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/perl -w
2
3use strict;
4use warnings;
5
6my $header = <<'END';
7/*
8 *             Copyright Andrey Semashev 2018.
9 * Distributed under the Boost Software License, Version 1.0.
10 *    (See accompanying file LICENSE_1_0.txt or copy at
11 *          http://www.boost.org/LICENSE_1_0.txt)
12 */
13/*!
14 * \file   error_codes_abi.cpp
15 * \author Andrey Semashev
16 * \date   09.03.2018
17 *
18 * \brief  This file contains ABI test for error_codes.hpp
19 */
20
21#include <boost/winapi/error_codes.hpp>
22#include <windows.h>
23#include <winerror.h>
24#include <boost/predef/platform/windows_uwp.h>
25#include "abi_test_tools.hpp"
26
27int main()
28{
29END
30
31my $footer = <<'END';
32
33    return boost::report_errors();
34}
35END
36
37print $header;
38
39while (<>)
40{
41    my $line = $_;
42    chomp($line);
43    if ($line =~ /^\s*BOOST_CONSTEXPR_OR_CONST\s+DWORD_\s+([a-zA-Z_\d]+)_\s+.*$/)
44    {
45        print "#if ";
46        # Some constants have different values in different Windows SDKs
47        if ($1 eq "ERROR_IPSEC_IKE_NEG_STATUS_END")
48        {
49            print "BOOST_PLAT_WINDOWS_SDK_VERSION >= BOOST_WINAPI_WINDOWS_SDK_6_0 && ";
50        }
51        print "defined(", $1 , ")\n";
52        print "    BOOST_WINAPI_TEST_CONSTANT(", $1 , ");\n";
53        print "#endif\n";
54    }
55}
56
57print $footer;
58