1#!/usr/bin/perl -w 2 3# Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) 4# 5# Distributed under the Boost Software License, Version 1.0. (See accompanying 6# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 8use strict; 9 10open(my $fh, "<../include/boost/asio/detail/config.hpp") or die("can't open config.hpp"); 11 12my $current_comment = ""; 13my %has_macros = (); 14my %disable_macros = (); 15 16while (my $line = <$fh>) 17{ 18 chomp($line); 19 if ($line =~ /^$/) 20 { 21 $current_comment = ""; 22 } 23 elsif ($line =~ /^\/\/ (.*)$/) 24 { 25 $current_comment = $current_comment . $1 . "\n"; 26 } 27 elsif ($line =~ /^# *define *BOOST_ASIO_HAS_([A-Z-0-9_]*) 1/) 28 { 29 if (not defined($has_macros{$1})) 30 { 31 $has_macros{$1} = $current_comment; 32 } 33 } 34 elsif ($line =~ /BOOST_ASIO_DISABLE_([A-Z-0-9_]*)/) 35 { 36 $disable_macros{$1} = 1; 37 } 38} 39 40my $intro = <<EOF; 41[/ 42 / Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) 43 / 44 / Distributed under the Boost Software License, Version 1.0. (See accompanying 45 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 46 /] 47 48[heading Compiler/platform feature detection macros] 49 50Asio automatically defines preprocessor macros corresponding to the detected 51available features on a particular compiler and target platform. These macros 52are named with the prefix `BOOST_ASIO_HAS_`, and are listed in the table below. 53 54Many of these macros also have a corresponding `BOOST_ASIO_DISABLE_` macro that 55may be used to explicitly disable the feature. 56 57In general, `BOOST_ASIO_HAS_` macros should not be explicitly defined by the 58user, except when absolutely required as a workaround for the latest version of 59a compiler or platform. For older compiler/platform combinations where a 60specific `BOOST_ASIO_HAS_` macro is not automatically defined, testing may have 61shown that a claimed feature isn't sufficiently conformant to be compatible 62with Boost.Asio's needs. 63EOF 64 65print("$intro\n"); 66print("[table\n"); 67print(" [[Macro][Description][Macro to disable feature]]\n"); 68for my $macro (sort keys %has_macros) 69{ 70 print(" [\n"); 71 print(" [`BOOST_ASIO_HAS_$macro`]\n"); 72 print(" [\n"); 73 my $description = $has_macros{$macro}; 74 chomp($description); 75 $description =~ s/\n/\n /g; 76 print(" $description\n"); 77 print(" ]\n"); 78 if (defined $disable_macros{$macro}) 79 { 80 print(" [`BOOST_ASIO_DISABLE_$macro`]\n"); 81 } 82 else 83 { 84 print(" []\n"); 85 } 86 print(" ]\n"); 87} 88print("]\n"); 89