Changeset 2174
- Timestamp:
- 06/07/08 09:33:42 (6 months ago)
- Files:
-
- psad/trunk/Storable/ChangeLog (modified) (1 diff)
- psad/trunk/Storable/MANIFEST (modified) (2 diffs)
- psad/trunk/Storable/Storable.pm (modified) (1 diff)
- psad/trunk/Storable/Storable.xs (modified) (1 diff)
- psad/trunk/Storable/VERSION (modified) (1 diff)
- psad/trunk/Storable/ppport.h (modified) (129 diffs)
- psad/trunk/Storable/t/code.t (modified) (1 diff)
- psad/trunk/Storable/t/croak.t (modified) (1 diff)
- psad/trunk/Storable/t/file_magic.t (modified) (12 diffs)
- psad/trunk/Storable/t/make_overload.pl (added)
- psad/trunk/Storable/t/utf8hash.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
psad/trunk/Storable/ChangeLog
r2092 r2174 1 Thu Nov 22 13:24:18 IST 2007 Abhijit Menon-Sen <ams@toroid.org> 2 3 Version 2.18 4 5 Compile fixes for older Perls. (No functional changes.) 6 7 Sat Nov 17 02:12:12 IST 2007 Abhijit Menon-Sen <ams@toroid.org> 8 9 Version 2.17 10 11 Various broken tests fixed. (No functional changes.) 12 1 13 Sat Mar 31 06:11:06 IST 2007 Abhijit Menon-Sen <ams@toroid.org> 2 14 psad/trunk/Storable/MANIFEST
r2092 r2174 35 35 t/malice.t See if Storable copes with corrupt files 36 36 t/overload.t See if Storable works 37 t/make_overload.pl Make test data for overload.t 37 38 t/recurse.t See if Storable works 38 39 t/restrict.t See if Storable works … … 51 52 t/Test/More.pm For testing the CPAN release on pre 5.6.2 52 53 t/Test/Simple.pm For testing the CPAN release on pre 5.6.2 54 META.yml Module meta-data (added by MakeMaker) psad/trunk/Storable/Storable.pm
r2092 r2174 24 24 use vars qw($canonical $forgive_me $VERSION); 25 25 26 $VERSION = '2.1 6';26 $VERSION = '2.18'; 27 27 *AUTOLOAD = \&AutoLoader::AUTOLOAD; # Grrr... 28 28 psad/trunk/Storable/Storable.xs
r2092 r2174 21 21 #define NEED_load_module 22 22 #define NEED_vload_module 23 #define NEED_newCONSTSUB 23 24 #include "ppport.h" /* handle old perls */ 24 25 #endif psad/trunk/Storable/VERSION
r2092 r2174 1 2.1 61 2.18 psad/trunk/Storable/ppport.h
r2092 r2174 5 5 ---------------------------------------------------------------------- 6 6 7 ppport.h -- Perl/Pollution/Portability Version 3.1 18 9 Automatically created by Devel::PPPort running under perl 5.00800 3.7 ppport.h -- Perl/Pollution/Portability Version 3.13 8 9 Automatically created by Devel::PPPort running under perl 5.008008. 10 10 11 11 Do NOT edit this file directly! -- Edit PPPort_pm.PL and the … … 22 22 =head1 NAME 23 23 24 ppport.h - Perl/Pollution/Portability version 3.1 124 ppport.h - Perl/Pollution/Portability version 3.13 25 25 26 26 =head1 SYNOPSIS … … 57 57 58 58 This version of F<ppport.h> is designed to support operation with Perl 59 installations back to 5.003, and has been tested up to 5. 9.4.59 installations back to 5.003, and has been tested up to 5.10.0. 60 60 61 61 =head1 OPTIONS … … 79 79 If this option is given, a copy of each file will be saved with 80 80 the given suffix that contains the suggested changes. This does 81 not require any external programs. 81 not require any external programs. Note that this does not 82 automagially add a dot between the original filename and the 83 suffix. If you want the dot, you have to include it in the option 84 argument. 82 85 83 86 If neither C<--patch> or C<--copy> are given, the default is to … … 118 121 119 122 Don't output any hints. Hints often contain useful portability 120 notes. 123 notes. Warnings will still be displayed. 121 124 122 125 =head2 --nochanges … … 145 148 Lists the API elements for which compatibility is provided by 146 149 F<ppport.h>. Also lists if it must be explicitly requested, 147 if it has dependencies, and if there are hints for it.150 if it has dependencies, and if there are hints or warnings for it. 148 151 149 152 =head2 --list-unsupported … … 222 225 grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL 223 226 grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL 227 load_module() NEED_load_module NEED_load_module_GLOBAL 224 228 my_snprintf() NEED_my_snprintf NEED_my_snprintf_GLOBAL 225 229 my_strlcat() NEED_my_strlcat NEED_my_strlcat_GLOBAL … … 227 231 newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL 228 232 newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL 229 sv_2pv_nolen() NEED_sv_2pv_nolen NEED_sv_2pv_nolen_GLOBAL 233 newSVpvn_share() NEED_newSVpvn_share NEED_newSVpvn_share_GLOBAL 234 sv_2pv_flags() NEED_sv_2pv_flags NEED_sv_2pv_flags_GLOBAL 230 235 sv_2pvbyte() NEED_sv_2pvbyte NEED_sv_2pvbyte_GLOBAL 231 236 sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL 232 237 sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL 238 sv_pvn_force_flags() NEED_sv_pvn_force_flags NEED_sv_pvn_force_flags_GLOBAL 233 239 sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL 234 240 sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL 241 vload_module() NEED_vload_module NEED_vload_module_GLOBAL 235 242 vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL 236 243 warner() NEED_warner NEED_warner_GLOBAL … … 283 290 This would output context diffs with 10 lines of context. 284 291 292 If you want to create patched copies of your files instead, use: 293 294 perl ppport.h --copy=.new 295 285 296 To display portability information for the C<newSVpvn> function, 286 297 use: … … 358 369 use strict; 359 370 360 my $VERSION = 3.11; 371 # Disable broken TRIE-optimization 372 BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 } 373 374 my $VERSION = 3.13; 361 375 362 376 my %opt = ( … … 374 388 my $LF = '(?:\r\n|[\r\n])'; # line feed 375 389 my $HS = "[ \t]"; # horizontal whitespace 390 391 # Never use C comments in this file! 392 my $ccs = '/'.'*'; 393 my $cce = '*'.'/'; 394 my $rccs = quotemeta $ccs; 395 my $rcce = quotemeta $cce; 376 396 377 397 eval { … … 409 429 $opt{'compat-version'} = 5; 410 430 } 411 412 # Never use C comments in this file!!!!!413 my $ccs = '/'.'*';414 my $cce = '*'.'/';415 my $rccs = quotemeta $ccs;416 my $rcce = quotemeta $cce;417 431 418 432 my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ … … 533 547 PERL_BCDVERSION|5.009005||p 534 548 PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p 549 PERL_HASH|5.004000||p 535 550 PERL_INT_MAX|5.004000||p 536 551 PERL_INT_MIN|5.004000||p … … 551 566 PERL_MAGIC_isaelem|5.007002||p 552 567 PERL_MAGIC_isa|5.007002||p 553 PERL_MAGIC_mutex|5.00 7002||p568 PERL_MAGIC_mutex|5.009005||p 554 569 PERL_MAGIC_nkeys|5.007002||p 555 570 PERL_MAGIC_overload_elem|5.007002||p … … 609 624 PL_Sv|5.005000||p 610 625 PL_compiling|5.004050||p 611 PL_copline|5.00 5000||p626 PL_copline|5.009005||p 612 627 PL_curcop|5.004050||p 613 628 PL_curstash|5.004050||p … … 618 633 PL_dowarn|||pn 619 634 PL_errgv|5.004050||p 635 PL_expect|5.009005||p 620 636 PL_hexdigit|5.005000||p 621 637 PL_hints|5.005000||p … … 688 704 PerlIO_unread||5.007003| 689 705 PerlIO_write||5.007003| 690 Perl_warner_nocontext|5.006000||p 691 Perl_warner|5.006000||p 706 Perl_signbit||5.009005|n 692 707 PoisonFree|5.009004||p 693 708 PoisonNew|5.009004||p … … 710 725 STR_WITH_LEN|5.009003||p 711 726 ST||| 727 SV_CONST_RETURN|5.009003||p 728 SV_COW_DROP_PV|5.008001||p 729 SV_COW_SHARED_HASH_KEYS|5.009005||p 730 SV_GMAGIC|5.007002||p 731 SV_HAS_TRAILING_NUL|5.009004||p 732 SV_IMMEDIATE_UNREF|5.007001||p 733 SV_MUTABLE_RETURN|5.009003||p 734 SV_NOSTEAL|5.009002||p 735 SV_SMAGIC|5.009003||p 736 SV_UTF8_NO_ENCODING|5.008001||p 712 737 SVf|5.006000||p 713 738 SVt_IV||| … … 721 746 Slab_Alloc||| 722 747 Slab_Free||| 748 Slab_to_rw||| 723 749 StructCopy||| 724 750 SvCUR_set||| … … 770 796 SvPVX_mutable|5.009003||p 771 797 SvPVX||| 798 SvPV_const|5.009003||p 799 SvPV_flags_const_nolen|5.009003||p 800 SvPV_flags_const|5.009003||p 801 SvPV_flags_mutable|5.009003||p 802 SvPV_flags|5.007002||p 803 SvPV_force_flags_mutable|5.009003||p 804 SvPV_force_flags_nolen|5.009003||p 805 SvPV_force_flags|5.007002||p 806 SvPV_force_mutable|5.009003||p 807 SvPV_force_nolen|5.009003||p 808 SvPV_force_nomg_nolen|5.009003||p 772 809 SvPV_force_nomg|5.007002||p 773 SvPV_force||| 810 SvPV_force|||p 811 SvPV_mutable|5.009003||p 812 SvPV_nolen_const|5.009003||p 774 813 SvPV_nolen|5.006000||p 814 SvPV_nomg_const_nolen|5.009003||p 815 SvPV_nomg_const|5.009003||p 775 816 SvPV_nomg|5.007002||p 776 817 SvPV_set||| … … 802 843 SvRV_set|5.009003||p 803 844 SvRV||| 845 SvRXOK||5.009005| 846 SvRX||5.009005| 804 847 SvSETMAGIC||| 848 SvSHARED_HASH|5.009003||p 805 849 SvSHARE||5.007003| 806 850 SvSTASH_set|5.009003||p … … 817 861 SvTYPE||| 818 862 SvUNLOCK||5.007003| 819 SvUOK| |5.007001|863 SvUOK|5.007001|5.006000|p 820 864 SvUPGRADE||| 821 865 SvUTF8_off||5.006000| … … 832 876 THIS|||n 833 877 UNDERBAR|5.009002||p 878 UTF8_MAXBYTES|5.009002||p 834 879 UVSIZE|5.006000||p 835 880 UVTYPE|5.006000||p … … 840 885 WARN_ALL|5.006000||p 841 886 WARN_AMBIGUOUS|5.006000||p 842 WARN_ASSERTIONS|5.00900 0||p887 WARN_ASSERTIONS|5.009005||p 843 888 WARN_BAREWORD|5.006000||p 844 889 WARN_CLOSED|5.006000||p … … 921 966 aMY_CXT_|5.007003||p 922 967 aMY_CXT|5.007003||p 923 aTHXR_| ||p924 aTHXR| ||p968 aTHXR_|5.009005||p 969 aTHXR|5.009005||p 925 970 aTHX_|5.006000||p 926 971 aTHX|5.006000||p … … 946 991 av_arylen_p||5.009003| 947 992 av_clear||| 993 av_create_and_push||5.009005| 994 av_create_and_unshift_one||5.009005| 948 995 av_delete||5.006000| 949 996 av_exists||5.006000| … … 970 1017 boot_core_PerlIO||| 971 1018 boot_core_UNIVERSAL||| 1019 boot_core_mro||| 972 1020 boot_core_xsutils||| 973 1021 bytes_from_utf8||5.007001| … … 1015 1063 ck_null||| 1016 1064 ck_open||| 1065 ck_readline||| 1017 1066 ck_repeat||| 1018 1067 ck_require||| … … 1072 1121 dSP||| 1073 1122 dTHR|5.004050||p 1074 dTHXR| ||p1123 dTHXR|5.009005||p 1075 1124 dTHXa|5.006000||p 1076 1125 dTHXoa|5.006000||p … … 1195 1244 dumpuntil||| 1196 1245 dup_attrlist||| 1246 emulate_cop_io||| 1197 1247 emulate_eaccess||| 1198 1248 eval_pv|5.006000||p … … 1208 1258 filter_gets||| 1209 1259 filter_read||| 1260 find_and_forget_pmops||| 1210 1261 find_array_subscript||| 1211 1262 find_beginning||| … … 1213 1264 find_hash_subscript||| 1214 1265 find_in_my_stash||| 1215 find_runcv|| |1266 find_runcv||5.008001| 1216 1267 find_rundefsvoffset||5.009002| 1217 1268 find_script||| … … 1225 1276 force_version||| 1226 1277 force_word||| 1278 forget_pmop||| 1227 1279 form_nocontext|||vn 1228 1280 form||5.004000|v … … 1236 1288 get_av|5.006000||p 1237 1289 get_context||5.006000|n 1290 get_cvn_flags||5.009005| 1238 1291 get_cv|5.006000||p 1239 1292 get_db_sub||| … … 1248 1301 get_opargs||| 1249 1302 get_ppaddr||5.006000| 1303 get_re_arg||| 1250 1304 get_sv|5.006000||p 1251 1305 get_vtbl||5.005030| … … 1277 1331 gv_efullname||| 1278 1332 gv_ename||| 1333 gv_fetchfile_flags||5.009005| 1279 1334 gv_fetchfile||| 1280 1335 gv_fetchmeth_autoload||5.007003| … … 1359 1414 init_ids||| 1360 1415 init_interp||| 1361 init_lexer|||1362 1416 init_main_stash||| 1363 1417 init_perllib||| … … 1447 1501 list||| 1448 1502 load_module_nocontext|||vn 1449 load_module| |5.006000|v1503 load_module|5.006000||pv 1450 1504 localize||| 1451 1505 looks_like_bool||| … … 1555 1609 more_sv||| 1556 1610 moreswitches||| 1611 mro_get_linear_isa_c3||5.009005| 1612 mro_get_linear_isa_dfs||5.009005| 1613 mro_get_linear_isa||5.009005| 1614 mro_isa_changed_in||| 1615 mro_meta_dup||| 1616 mro_meta_init||| 1617 mro_method_changed_in||5.009005| 1557 1618 mul128||| 1558 1619 mulexp10|||n … … 1570 1631 my_chsize||| 1571 1632 my_clearenv||| 1633 my_cxt_index||| 1572 1634 my_cxt_init||| 1635 my_dirfd||5.009005| 1573 1636 my_exit_jump||| 1574 1637 my_exit||| … … 1651 1714 newNULLLIST||| 1652 1715 newOP||| 1653 newPADOP|| 5.006000|1716 newPADOP||| 1654 1717 newPMOP||| 1655 1718 newPROG||| … … 1664 1727 newSVOP||| 1665 1728 newSVREF||| 1729 newSV_type||5.009005| 1666 1730 newSVhek||5.009003| 1667 1731 newSViv||| … … 1669 1733 newSVpvf_nocontext|||vn 1670 1734 newSVpvf||5.004000|v 1671 newSVpvn_share| |5.007001|1735 newSVpvn_share|5.007001||p 1672 1736 newSVpvn|5.004050||p 1673 1737 newSVpvs_share||5.009003| … … 1716 1780 op_getmad||| 1717 1781 op_null||5.007002| 1782 op_refcnt_dec||| 1783 op_refcnt_inc||| 1718 1784 op_refcnt_lock||5.009002| 1719 1785 op_refcnt_unlock||5.009002| … … 1751 1817 parse_body||| 1752 1818 parse_unicode_opts||| 1819 parser_dup||| 1820 parser_free||| 1753 1821 path_is_absolute|||n 1754 1822 peep||| 1755 pending_ ident|||1823 pending_Slabs_to_ro||| 1756 1824 perl_alloc_using|||n 1757 1825 perl_alloc|||n … … 1771 1839 pmtrans||| 1772 1840 pop_scope||| 1773 pregcomp|| |1841 pregcomp||5.009005| 1774 1842 pregexec||| 1775 1843 pregfree||| … … 1778 1846 printbuf||| 1779 1847 printf_nocontext|||vn 1780 ptr_table_clear||| 1781 ptr_table_fetch||| 1848 process_special_blocks||| 1849 ptr_table_clear||5.009005| 1850 ptr_table_fetch||5.009005| 1782 1851 ptr_table_find|||n 1783 ptr_table_free|| |1784 ptr_table_new|| |1785 ptr_table_split|| |1786 ptr_table_store|| |1852 ptr_table_free||5.009005| 1853 ptr_table_new||5.009005| 1854 ptr_table_split||5.009005| 1855 ptr_table_store||5.009005| 1787 1856 push_scope||| 1788 1857 put_byte||| … … 1793 1862 qerror||| 1794 1863 qsortsvu||| 1864 re_compile||5.009005| 1795 1865 re_croak2||| 1796 1866 re_dup||| 1797 re_intuit_start||5.00 6000|1867 re_intuit_start||5.009005| 1798 1868 re_intuit_string||5.006000| 1799 1869 readpipe_override||| … … 1813 1883 ref||5.009003| 1814 1884 reg_check_named_buff_matched||| 1815 reg_named_buff_sv||| 1885 reg_named_buff_all||5.009005| 1886 reg_named_buff_exists||5.009005| 1887 reg_named_buff_fetch||5.009005| 1888 reg_named_buff_firstkey||5.009005| 1889 reg_named_buff_iter||| 1890 reg_named_buff_nextkey||5.009005| 1891 reg_named_buff_scalar||5.009005| 1892 reg_named_buff||| 1816 1893 reg_namedseq||| 1817 1894 reg_node||| 1895 reg_numbered_buff_fetch||| 1896 reg_numbered_buff_length||| 1897 reg_numbered_buff_store||| 1898 reg_qr_package||| 1818 1899 reg_recode||| 1819 1900 reg_scan_name||| 1820 reg_stringify||| 1901 reg_skipcomment||| 1902 reg_stringify||5.009005| 1903 reg_temp_copy||| 1821 1904 reganode||| 1822 1905 regatom||| … … 1827 1910 regcppush||| 1828 1911 regcurly|||n 1912 regdump_extflags||| 1829 1913 regdump||5.005000| 1830 regdupe |||1914 regdupe_internal||| 1831 1915 regexec_flags||5.005000| 1916 regfree_internal||5.009005| 1832 1917 reghop3|||n 1833 1918 reghop4|||n … … 1851 1936 report_evil_fh||| 1852 1937 report_uninit||| 1853 require_errno|||1854 1938 require_pv||5.006000| 1939 require_tie_mod||| 1855 1940 restore_magic||| 1856 1941 rninstr||| … … 1918 2003 savepvs||5.009003| 1919 2004 savepv||| 2005 savesharedpvn||5.009005| 1920 2006 savesharedpv||5.007003| 1921 2007 savestack_grow_cnt||5.008001| … … 1944 2030 scan_trans||| 1945 2031 scan_version||5.009001| 1946 scan_vstring||5.00 8001|2032 scan_vstring||5.009005| 1947 2033 scan_word||| 1948 2034 scope||| … … 1968 2054 skipspace2||| 1969 2055 skipspace||| 2056 softref2xv||| 1970 2057 sortcv_stacked||| 1971 2058 sortcv_xsub||| … … 2005 2092 sv_2mortal||| 2006 2093 sv_2nv||| 2007 sv_2pv_flags| |5.007002|2094 sv_2pv_flags|5.007002||p 2008 2095 sv_2pv_nolen|5.006000||p 2009 sv_2pvbyte_nolen| ||2096 sv_2pvbyte_nolen|5.006000||p 2010 2097 sv_2pvbyte|5.006000||p 2011 2098 sv_2pvutf8_nolen||5.006000| … … 2069 2156 sv_len_utf8||5.006000| 2070 2157 sv_len||| 2158 sv_magic_portable|5.009005|5.004000|p 2071 2159 sv_magicext||5.007003| 2072 2160 sv_magic||| … … 2089 2177 sv_pvbyten||5.006000| 2090 2178 sv_pvbyte||5.006000| 2091 sv_pvn_force_flags| |5.007002|2092 sv_pvn_force||| p2179 sv_pvn_force_flags|5.007002||p 2180 sv_pvn_force||| 2093 2181 sv_pvn_nomg|5.007003||p 2094 sv_pvn| 5.005000||p2182 sv_pvn||| 2095 2183 sv_pvutf8n_force||5.006000| 2096 2184 sv_pvutf8n||5.006000| … … 2100 2188 sv_reftype||| 2101 2189 sv_release_COW||| 2102 sv_release_IVX|||2103 2190 sv_replace||| 2104 2191 sv_report_used||| … … 2160 2247 svtype||| 2161 2248 swallow_bom||| 2249 swap_match_buff||| 2162 2250 swash_fetch||5.007002| 2163 2251 swash_get||| … … 2201 2289 unsharepvn||5.004000| 2202 2290 unwind_handler_stack||| 2203 upg_version||5.009000| 2291 update_debugger_info||| 2292 upg_version||5.009005| 2204 2293 usage||| 2205 2294 utf16_to_utf8_reversed||5.006001| … … 2231 2320 vivify_defelem||| 2232 2321 vivify_ref||| 2233 vload_module| |5.006000|2322 vload_module|5.006000||p 2234 2323 vmess||5.006000| 2235 2324 vnewSVpvf|5.006000|5.004000|p … … 2274 2363 # Scan for possible replacement candidates 2275 2364 2276 my(%replace, %need, %hints, % depends);2365 my(%replace, %need, %hints, %warnings, %depends); 2277 2366 my $replace = 0; 2278 my $hint = ''; 2367 my($hint, $define, $function); 2368 2369 sub find_api 2370 { 2371 my $code = shift; 2372 $code =~ s{ 2373 / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*) 2374 | "[^"\\]*(?:\\.[^"\\]*)*" 2375 | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx; 2376 grep { exists $API{$_} } $code =~ /(\w+)/mg; 2377 } 2279 2378 2280 2379 while (<DATA>) { 2281 2380 if ($hint) { 2381 my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings; 2282 2382 if (m{^\s*\*\s(.*?)\s*$}) { 2283 $hints{$hint} ||= ''; # suppress warning with older perls 2284 $hints{$hint} .= "$1\n"; 2383 for (@{$hint->[1]}) { 2384 $h->{$_} ||= ''; # suppress warning with older perls 2385 $h->{$_} .= "$1\n"; 2386 } 2387 } 2388 else { undef $hint } 2389 } 2390 2391 $hint = [$1, [split /,?\s+/, $2]] 2392 if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$}; 2393 2394 if ($define) { 2395 if ($define->[1] =~ /\\$/) { 2396 $define->[1] .= $_; 2285 2397 } 2286 2398 else { 2287 $hint = ''; 2399 if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) { 2400 my @n = find_api($define->[1]); 2401 push @{$depends{$define->[0]}}, @n if @n 2402 } 2403 undef $define; 2288 2404 } 2289 2405 } 2290 $hint = $1 if m{^\s*$rccs\sHint:\s+(\w+)\s*$}; 2406 2407 $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)}; 2408 2409 if ($function) { 2410 if (/^}/) { 2411 if (exists $API{$function->[0]}) { 2412 my @n = find_api($function->[1]); 2413 push @{$depends{$function->[0]}}, @n if @n 2414 } 2415 undef $define; 2416 } 2417 else { 2418 $function->[1] .= $_; 2419 } 2420 } 2421 2422 $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)}; 2291 2423 2292 2424 $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; … … 2300 2432 2301 2433 $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; 2434 } 2435 2436 for (values %depends) { 2437 my %s; 2438 $_ = [sort grep !$s{$_}++, @$_]; 2302 2439 } 2303 2440 … … 2320 2457 print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; 2321 2458 print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; 2322 print "$hints{$f}" if exists $hints{$f}; 2459 print "\n$hints{$f}" if exists $hints{$f}; 2460 print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f}; 2323 2461 $info++; 2324 2462 } 2325 unless ($info) { 2326 print "No portability information available.\n"; 2327 } 2463 print "No portability information available.\n" unless $info; 2328 2464 $count++; 2329 2465 } 2330 if ($count > 0) { 2331 print "\n"; 2332 } 2333 else { 2334 print "Found no API matching '$opt{'api-info'}'.\n"; 2335 } 2466 $count or print "Found no API matching '$opt{'api-info'}'."; 2467 print "\n"; 2336 2468 exit 0; 2337 2469 } … … 2345 2477 push @flags, 'depend' if exists $depends{$f}; 2346 2478 push @flags, 'hint' if exists $hints{$f}; 2479 push @flags, 'warning' if exists $warnings{$f}; 2347 2480 my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; 2348 2481 print "$f$flags\n"; … … 2352 2485 2353 2486 my @files; 2354 my @srcext = qw( xs c h cc cpp);2355 my $srcext = join '|', @srcext;2487 my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc ); 2488 my $srcext = join '|', map { quotemeta $_ } @srcext; 2356 2489 2357 2490 if (@ARGV) { 2358 2491 my %seen; 2359 @files = grep { -f && !exists $seen{$_} } map { glob $_ } @ARGV; 2492 for (@ARGV) { 2493 if (-e) { 2494 if (-f) { 2495 push @files, $_ unless $seen{$_}++; 2496 } 2497 else { warn "'$_' is not a file.\n" } 2498 } 2499 else { 2500 my @new = grep { -f } glob $_ 2501 or warn "'$_' does not exist.\n"; 2502 push @files, grep { !$seen{$_}++ } @new; 2503 } 2504 } 2360 2505 } 2361 2506 else { … … 2363 2508 require File::Find; 2364 2509 File::Find::find(sub { 2365 $File::Find::name =~ / \.($srcext)$/i2510 $File::Find::name =~ /($srcext)$/i 2366 2511 and push @files, $File::Find::name; 2367 2512 }, '.'); 2368 2513 }; 2369 2514 if ($@) { 2370 @files = map { glob "* .$_" } @srcext;2515 @files = map { glob "*$_" } @srcext; 2371 2516 } 2372 2517 } … … 2376 2521 my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; 2377 2522 for (@files) { 2378 my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/ \.($srcext)$/i;2523 my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i; 2379 2524 push @{ $out ? \@out : \@in }, $_; 2380 2525 } … … 2385 2530 } 2386 2531 2387 unless (@files) { 2388 die "No input files given!\n"; 2389 } 2532 die "No input files given!\n" unless @files; 2390 2533 2391 2534 my(%files, %global, %revreplace); … … 2407 2550 my %file = (orig => $c, changes => 0); 2408 2551 2409 # temporarily remove C comments from the code2552 # Temporarily remove C/XS comments and strings from the code 2410 2553 my @ccom; 2554 2411 2555 $c =~ s{ 2412 ( 2413 [^"'/]+ 2414 | 2415 (?:"[^"\\]*(?:\\.[^"\\]*)*" [^"'/]*)+ 2416 | 2417 (?:'[^'\\]*(?:\\.[^'\\]*)*' [^"'/]*)+ 2418 ) 2419 | 2420 (/ (?: 2421 \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / 2422 | 2423 /[^\r\n]* 2424 )) 2425 }{ 2426 defined $2 and push @ccom, $2; 2427 defined $1 ? $1 : "$ccs$#ccom$cce"; 2428 }egsx; 2556 ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]* 2557 | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* ) 2558 | ( ^$HS*\#[^\r\n]* 2559 | "[^"\\]*(?:\\.[^"\\]*)*" 2560 | '[^'\\]*(?:\\.[^'\\]*)*' 2561 | / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* ) ) 2562 }{ defined $2 and push @ccom, $2; 2563 defined $1 ? $1 : "$ccs$#ccom$cce" }mgsex; 2429 2564 2430 2565 $file{ccom} = \@ccom; 2431 2566 $file{code} = $c; 2432 $file{has_inc_ppport} = ($c =~ /#.*include.*\Q$ppport\E/);2567 $file{has_inc_ppport} = $c =~ /^$HS*#$HS*include[^\r\n]+\b\Q$ppport\E\b/m; 2433 2568 2434 2569 my $func; … … 2441 2576 $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; 2442 2577 if (exists $API{$func}{provided}) { 2578 $file{uses_provided}{$func}++; 2443 2579 if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) { 2444 2580 $file{uses}{$func}++; … … 2451 2587 } 2452 2588 for ($func, @deps) { 2453 if (exists $need{$_}) { 2454 $file{needs}{$_} = 'static'; 2455 } 2589 $file{needs}{$_} = 'static' if exists $need{$_}; 2456 2590 } 2457 2591 } … … 2469 2603 $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++; 2470 2604 } 2471 else { 2472 warning("Possibly wrong #define $1 in $filename"); 2473 } 2605 else { warning("Possibly wrong #define $1 in $filename") } 2474 2606 } 2475 2607 … … 2508 2640 my $func; 2509 2641 my $c = $file{code}; 2642 my $warnings = 0; 2510 2643 2511 2644 for $func (sort keys %{$file{uses_Perl}}) { 2512 2645 if ($API{$func}{varargs}) { 2513 my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} 2514 { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); 2515 if ($changes) { 2516 warning("Doesn't pass interpreter argument aTHX to Perl_$func"); 2517 $file{changes} += $changes; 2646 unless ($API{$func}{nothxarg}) { 2647 my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} 2648 { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); 2649 if ($changes) { 2650 warning("Doesn't pass interpreter argument aTHX to Perl_$func"); 2651 $file{changes} += $changes; 2652 } 2518 2653 } 2519 2654 } … … 2530 2665 } 2531 2666 2532 for $func (sort keys %{$file{uses}}) { 2533 next unless $file{uses}{$func}; # if it's only a dependency 2534 if (exists $file{uses_deps}{$func}) { 2535 diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); 2667 for $func (sort keys %{$file{uses_provided}}) { 2668 if ($file{uses}{$func}) { 2669 if (exists $file{uses_deps}{$func}) { 2670 diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); 2671 } 2672 else { 2673 diag("Uses $func"); 2674 } 2536 2675 } 2537 elsif (exists $replace{$func}) { 2538 warning("Uses $func instead of $replace{$func}"); 2539 $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); 2676 $warnings += hint($func); 2677 } 2678 2679 unless ($opt{quiet}) { 2680 for $func (sort keys %{$file{uses_todo}}) { 2681 print "*** WARNING: Uses $func, which may not be portable below perl ", 2682 format_version($API{$func}{todo}), ", even with '$ppport'\n"; 2683 $warnings++; 2540 2684 } 2541 else {2542 diag("Uses $func");2543 }2544 hint($func);2545 }2546 2547 for $func (sort keys %{$file{uses_todo}}) {2548 warning("Uses $func, which may not be portable below perl ",2549 format_version($API{$func}{todo}));2550 2685 } 2551 2686 … … 2645 2780 warning("Uses $cppc C++ style comment$s, which is not portable"); 2646 2781 } 2782 2783 my $s = $warnings != 1 ? 's' : ''; 2784 my $warn = $warnings ? " ($warnings warning$s)" : ''; 2785 info("Analysis completed$warn"); 2647 2786 2648 2787 if ($file{changes}) { … … 2700 2839 2701 2840 2841 sub try_use { eval "use @_;"; return $@ eq '' } 2842 2702 2843 sub mydiff 2703 2844 { … … 2710 2851 } 2711 2852 2712 if (!defined $diff and can_use('Text::Diff')) {2853 if (!defined $diff and try_use('Text::Diff')) { 2713 2854 $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' }); 2714 2855 $diff = <<HEADER . $diff; … … 2732 2873 2733 2874 print F $diff; 2734 2735 2875 } 2736 2876 … … 2769 2909 } 2770 2910 2771 sub can_use2772 {2773 eval "use @_;";2774 return $@ eq '';2775 }2776 2777 2911 sub rec_depend 2778 2912 { 2779 my $func = shift; 2780 my %seen; 2913 my($func, $seen) = @_; 2781 2914 return () unless exists $depends{$func}; 2782 grep !$seen{$_}++, map { ($_, rec_depend($_)) } @{$depends{$func}}; 2915 $seen = {%{$seen||{}}}; 2916 return () if $seen->{$func}++; 2917 my %s; 2918 grep !$s{$_}++, map { ($_, rec_depend($_, $seen)) } @{$depends{$func}}; 2783 2919 } 2784 2920 … … 2860 2996 2861 2997 my %given_hints; 2998 my %given_warnings; 2862 2999 sub hint 2863 3000 { 2864 3001 $opt{quiet} and return; 2865 $opt{hints} or return;2866 3002 my $func = shift; 2867 exists $hints{$func} or return; 2868 $given_hints{$func}++ and return; 2869 my $hint = $hints{$func}; 2870 $hint =~ s/^/ /mg; 2871 print " --- hint for $func ---\n", $hint; 3003 my $rv = 0; 3004 if (exists $warnings{$func} && !$given_warnings{$func}++) { 3005 my $warn = $warnings{$func}; 3006 $warn =~ s!^!*** !mg; 3007 print "*** WARNING: $func\n", $warn; 3008 $rv++; 3009 } 3010 if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) { 3011 my $hint = $hints{$func}; 3012 $hint =~ s/^/ /mg; 3013 print " --- hint for $func ---\n", $hint; 3014 } 3015 $rv; 2872 3016 } 2873 3017 … … 2919 3063 END 2920 3064 /ms; 3065 my($pl, $c) = $self =~ /(.*^__DATA__)(.*)/ms; 3066 $c =~ s{ 3067 / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*) 3068 | ( "[^"\\]*(?:\\.[^"\\]*)*" 3069 | '[^'\\]*(?:\\.[^'\\]*)*' ) 3070 | ($HS+) }{ defined $2 ? ' ' : ($1 || '') }gsex; 3071 $c =~ s!\s+$!!mg; 3072 $c =~ s!^$LF!!mg; 3073 $c =~ s!^\s*#\s*!#!mg; 3074 $c =~ s!^\s+!!mg; 2921 3075 2922 3076 open OUT, ">$0" or die "cannot strip $0: $!\n"; 2923 print OUT $self;3077 print OUT "$pl$c\n"; 2924 3078 2925 3079 exit 0; … … 2957 3111 #endif 2958 3112 2959 #define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION) 3113 #define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10)) 3114 #define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION)) 2960 3115 2961 3116 /* It is very unlikely that anyone will try to use this with Perl 6 … … 3342 3497 # define sv_uv(sv) SvUVx(sv) 3343 3498 #endif 3499 3500 #if !defined(SvUOK) && defined(SvIOK_UV) 3501 # define SvUOK(sv) SvIOK_UV(sv) 3502 #endif 3344 3503 #ifndef XST_mUV 3345 3504 # define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) … … 3616 3775 #endif 3617 3776 3618 #if ( (PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 0)))3777 #if (PERL_BCDVERSION < 0x5005000) 3619 3778 # undef XSRETURN 3620 3779 # define XSRETURN(off) \ … … 3633 3792 # define SVf "_" 3634 3793 #endif 3794 #ifndef UTF8_MAXBYTES 3795 # define UTF8_MAXBYTES UTF8_MAXLEN 3796 #endif 3797 #ifndef PERL_HASH 3798 # define PERL_HASH(hash,str,len) \ 3799 STMT_START { \ 3800 const char *s_PeRlHaSh = str; \ 3801 I32 i_PeRlHaSh = len; \ 3802 U32 hash_PeRlHaSh = 0; \ 3803 while (i_PeRlHaSh--) \ 3804 hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \ 3805 (hash) = hash_PeRlHaSh; \ 3806 } STMT_END 3807 #endif 3635 3808 3636 3809 #ifndef PERL_SIGNALS_UNSAFE_FLAG … … 3638 3811 #define PERL_SIGNALS_UNSAFE_FLAG 0x0001 3639 3812 3640 #if ( (PERL_VERSION < 8) || ((PERL_VERSION == 8) && (PERL_SUBVERSION < 0)))3813 #if (PERL_BCDVERSION < 0x5008000) 3641 3814 # define D_PPP_PERL_SIGNALS_INIT PERL_SIGNALS_UNSAFE_FLAG 3642 3815 #else … … 3662 3835 */ 3663 3836 3664 #if ( (PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION <= 4)))3837 #if (PERL_BCDVERSION <= 0x5005005) 3665 3838 /* Replace: 1 */ 3666 3839 # define PL_ppaddr ppaddr … … 3669 3842 #endif 3670 3843 3671 #if ( (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))3844 #if (PERL_BCDVERSION <= 0x5004005) 3672 3845 /* Replace: 1 */ 3673 3846 # define PL_DBsignal DBsignal … … 3686 3859 # define PL_dowarn dowarn 3687 3860 # define PL_errgv errgv 3861 # define PL_expect expect 3688 3862 # define PL_hexdigit hexdigit 3689 3863 # define PL_hints hints … … 3706 3880 /* Replace: 0 */ 3707 3881 #endif 3882 3883 /* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters 3884 * Do not use this variable. It is internal to the perl parser 3885 * and may change or even be removed in the future. Note that 3886 * as of perl 5.9.5 you cannot assign to this variable anymore. 3887 */ 3888 3889 /* TODO: cannot assign to these vars; is it worth fixing? */ 3890 #if (PERL_BCDVERSION >= 0x5009005) 3891 # define PL_expect (PL_parser ? PL_parser->expect : 0) 3892 # define PL_copline (PL_parser ? PL_parser->copline : 0) 3893 # define PL_rsfp (PL_parser ? PL_parser->rsfp : (PerlIO *) 0) 3894 # define PL_rsfp_filters (PL_parser ? PL_parser->rsfp_filters : (AV *) 0) 3895 #endif 3708 3896 #ifndef dTHR 3709 3897 # define dTHR dNOOP … … 3732 3920 #endif 3733 3921 3734 #if ( (PERL_VERSION < 6) || ((PERL_VERSION == 6) && (PERL_SUBVERSION < 0)))3922 #if (PERL_BCDVERSION < 0x5006000) 3735 3923 # ifdef USE_THREADS 3736 3924 # define aTHXR thr 3737 # define aTHXR_ thr, 3925 # define aTHXR_ thr, 3738 3926 # else 3739 3927 # define aTHXR … … 3807 3995 # define eval_sv perl_eval_sv
