diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ASN1.c | 268 | ||||
-rw-r--r-- | lib/ASN1.y | 8 | ||||
-rw-r--r-- | lib/Makefile.in | 25 | ||||
-rw-r--r-- | lib/decoding.c | 28 | ||||
-rw-r--r-- | lib/element.c | 8 | ||||
-rw-r--r-- | lib/gllib/Makefile.am | 42 | ||||
-rw-r--r-- | lib/gllib/Makefile.in | 65 | ||||
-rw-r--r-- | lib/gllib/hash-pjw-bare.c | 2 | ||||
-rw-r--r-- | lib/gllib/hash-pjw-bare.h | 4 | ||||
-rw-r--r-- | lib/gllib/intprops.h | 266 | ||||
-rw-r--r-- | lib/gllib/limits.in.h | 63 | ||||
-rw-r--r-- | lib/gllib/minmax.h | 2 | ||||
-rw-r--r-- | lib/gllib/stddef.in.h | 56 | ||||
-rw-r--r-- | lib/gllib/stdint.in.h | 764 | ||||
-rw-r--r-- | lib/gllib/string.in.h | 39 | ||||
-rw-r--r-- | lib/gllib/strverscmp.c | 100 | ||||
-rw-r--r-- | lib/gllib/sys_types.in.h | 2 | ||||
-rw-r--r-- | lib/gllib/verify.h | 279 | ||||
-rw-r--r-- | lib/glm4/gnulib-comp.m4 | 14 | ||||
-rw-r--r-- | lib/glm4/ld-version-script.m4 | 47 | ||||
-rw-r--r-- | lib/glm4/minmax.m4 | 2 | ||||
-rw-r--r-- | lib/glm4/string_h.m4 | 2 | ||||
-rw-r--r-- | lib/glm4/strverscmp.m4 | 2 | ||||
-rw-r--r-- | lib/glm4/visibility.m4 | 2 | ||||
-rw-r--r-- | lib/libtasn1.h | 4 | ||||
-rw-r--r-- | lib/parser_aux.c | 32 |
26 files changed, 1403 insertions, 723 deletions
@@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -256,7 +256,7 @@ extern int _asn1_yydebug; /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { #line 62 "ASN1.y" /* yacc.c:355 */ @@ -267,6 +267,8 @@ union YYSTYPE #line 269 "ASN1.c" /* yacc.c:355 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -280,7 +282,7 @@ int _asn1_yyparse (void); /* Copy the second part of user declarations. */ -#line 284 "ASN1.c" /* yacc.c:358 */ +#line 286 "ASN1.c" /* yacc.c:358 */ #ifdef short # undef short @@ -1540,86 +1542,86 @@ yyreduce: p_tree=(yyval.node); } -#line 1544 "ASN1.c" /* yacc.c:1646 */ +#line 1546 "ASN1.c" /* yacc.c:1646 */ break; case 3: #line 148 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} -#line 1550 "ASN1.c" /* yacc.c:1646 */ +#line 1552 "ASN1.c" /* yacc.c:1646 */ break; case 4: #line 149 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} -#line 1556 "ASN1.c" /* yacc.c:1646 */ +#line 1558 "ASN1.c" /* yacc.c:1646 */ break; case 5: #line 152 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"-%s",(yyvsp[0].str));} -#line 1562 "ASN1.c" /* yacc.c:1646 */ +#line 1564 "ASN1.c" /* yacc.c:1646 */ break; case 6: #line 155 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} -#line 1568 "ASN1.c" /* yacc.c:1646 */ +#line 1570 "ASN1.c" /* yacc.c:1646 */ break; case 7: #line 156 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} -#line 1574 "ASN1.c" /* yacc.c:1646 */ +#line 1576 "ASN1.c" /* yacc.c:1646 */ break; case 8: #line 159 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} -#line 1580 "ASN1.c" /* yacc.c:1646 */ +#line 1582 "ASN1.c" /* yacc.c:1646 */ break; case 9: #line 160 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} -#line 1586 "ASN1.c" /* yacc.c:1646 */ +#line 1588 "ASN1.c" /* yacc.c:1646 */ break; case 10: #line 163 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} -#line 1592 "ASN1.c" /* yacc.c:1646 */ +#line 1594 "ASN1.c" /* yacc.c:1646 */ break; case 11: #line 164 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"-%s",(yyvsp[0].str));} -#line 1598 "ASN1.c" /* yacc.c:1646 */ +#line 1600 "ASN1.c" /* yacc.c:1646 */ break; case 12: #line 165 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} -#line 1604 "ASN1.c" /* yacc.c:1646 */ +#line 1606 "ASN1.c" /* yacc.c:1646 */ break; case 13: #line 168 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} -#line 1610 "ASN1.c" /* yacc.c:1646 */ +#line 1612 "ASN1.c" /* yacc.c:1646 */ break; case 14: #line 169 "ASN1.y" /* yacc.c:1646 */ {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} -#line 1616 "ASN1.c" /* yacc.c:1646 */ +#line 1618 "ASN1.c" /* yacc.c:1646 */ break; case 15: #line 172 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT); _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} -#line 1623 "ASN1.c" /* yacc.c:1646 */ +#line 1625 "ASN1.c" /* yacc.c:1646 */ break; case 16: @@ -1627,27 +1629,27 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT); _asn1_set_name((yyval.node),(yyvsp[-3].str)); _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} -#line 1631 "ASN1.c" /* yacc.c:1646 */ +#line 1633 "ASN1.c" /* yacc.c:1646 */ break; case 17: #line 179 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 1637 "ASN1.c" /* yacc.c:1646 */ +#line 1639 "ASN1.c" /* yacc.c:1646 */ break; case 18: #line 180 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[-2].node); _asn1_set_right(_asn1_get_last_right((yyvsp[-2].node)),(yyvsp[0].node));} -#line 1644 "ASN1.c" /* yacc.c:1646 */ +#line 1646 "ASN1.c" /* yacc.c:1646 */ break; case 19: #line 184 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT); _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);} -#line 1651 "ASN1.c" /* yacc.c:1646 */ +#line 1653 "ASN1.c" /* yacc.c:1646 */ break; case 20: @@ -1655,108 +1657,108 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT); _asn1_set_name((yyval.node),(yyvsp[-3].str)); _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} -#line 1659 "ASN1.c" /* yacc.c:1646 */ +#line 1661 "ASN1.c" /* yacc.c:1646 */ break; case 21: #line 191 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 1665 "ASN1.c" /* yacc.c:1646 */ +#line 1667 "ASN1.c" /* yacc.c:1646 */ break; case 22: #line 192 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[-1].node); _asn1_set_right(_asn1_get_last_right((yyvsp[-1].node)),(yyvsp[0].node));} -#line 1672 "ASN1.c" /* yacc.c:1646 */ +#line 1674 "ASN1.c" /* yacc.c:1646 */ break; case 23: #line 196 "ASN1.y" /* yacc.c:1646 */ {(yyval.constant)=CONST_UNIVERSAL;} -#line 1678 "ASN1.c" /* yacc.c:1646 */ +#line 1680 "ASN1.c" /* yacc.c:1646 */ break; case 24: #line 197 "ASN1.y" /* yacc.c:1646 */ {(yyval.constant)=CONST_PRIVATE;} -#line 1684 "ASN1.c" /* yacc.c:1646 */ +#line 1686 "ASN1.c" /* yacc.c:1646 */ break; case 25: #line 198 "ASN1.y" /* yacc.c:1646 */ {(yyval.constant)=CONST_APPLICATION;} -#line 1690 "ASN1.c" /* yacc.c:1646 */ +#line 1692 "ASN1.c" /* yacc.c:1646 */ break; case 26: #line 201 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TAG); _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} -#line 1697 "ASN1.c" /* yacc.c:1646 */ +#line 1699 "ASN1.c" /* yacc.c:1646 */ break; case 27: #line 203 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TAG | (yyvsp[-2].constant)); _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} -#line 1704 "ASN1.c" /* yacc.c:1646 */ +#line 1706 "ASN1.c" /* yacc.c:1646 */ break; case 28: #line 207 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 1710 "ASN1.c" /* yacc.c:1646 */ +#line 1712 "ASN1.c" /* yacc.c:1646 */ break; case 29: #line 208 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_EXPLICIT);} -#line 1716 "ASN1.c" /* yacc.c:1646 */ +#line 1718 "ASN1.c" /* yacc.c:1646 */ break; case 30: #line 209 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_IMPLICIT);} -#line 1722 "ASN1.c" /* yacc.c:1646 */ +#line 1724 "ASN1.c" /* yacc.c:1646 */ break; case 31: #line 212 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFAULT); _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);} -#line 1729 "ASN1.c" /* yacc.c:1646 */ +#line 1731 "ASN1.c" /* yacc.c:1646 */ break; case 32: #line 214 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFAULT|CONST_TRUE);} -#line 1735 "ASN1.c" /* yacc.c:1646 */ +#line 1737 "ASN1.c" /* yacc.c:1646 */ break; case 33: #line 215 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFAULT|CONST_FALSE);} -#line 1741 "ASN1.c" /* yacc.c:1646 */ +#line 1743 "ASN1.c" /* yacc.c:1646 */ break; case 36: #line 224 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER);} -#line 1747 "ASN1.c" /* yacc.c:1646 */ +#line 1749 "ASN1.c" /* yacc.c:1646 */ break; case 37: #line 225 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER|CONST_LIST); _asn1_set_down((yyval.node),(yyvsp[-1].node));} -#line 1754 "ASN1.c" /* yacc.c:1646 */ +#line 1756 "ASN1.c" /* yacc.c:1646 */ break; case 38: #line 227 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER);} -#line 1760 "ASN1.c" /* yacc.c:1646 */ +#line 1762 "ASN1.c" /* yacc.c:1646 */ break; case 39: @@ -1765,32 +1767,32 @@ yyreduce: _asn1_set_down((yyval.node),_asn1_add_static_node(ASN1_ETYPE_SIZE)); _asn1_set_value(_asn1_get_down((yyval.node)),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1); _asn1_set_name(_asn1_get_down((yyval.node)),(yyvsp[-4].str));} -#line 1769 "ASN1.c" /* yacc.c:1646 */ +#line 1771 "ASN1.c" /* yacc.c:1646 */ break; case 40: #line 235 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BOOLEAN);} -#line 1775 "ASN1.c" /* yacc.c:1646 */ +#line 1777 "ASN1.c" /* yacc.c:1646 */ break; case 41: #line 238 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UTC_TIME);} -#line 1781 "ASN1.c" /* yacc.c:1646 */ +#line 1783 "ASN1.c" /* yacc.c:1646 */ break; case 42: #line 239 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_GENERALIZED_TIME);} -#line 1787 "ASN1.c" /* yacc.c:1646 */ +#line 1789 "ASN1.c" /* yacc.c:1646 */ break; case 43: #line 242 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SIZE|CONST_1_PARAM); _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} -#line 1794 "ASN1.c" /* yacc.c:1646 */ +#line 1796 "ASN1.c" /* yacc.c:1646 */ break; case 44: @@ -1798,149 +1800,149 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SIZE|CONST_MIN_MAX); _asn1_set_value((yyval.node),(yyvsp[-4].str),strlen((yyvsp[-4].str))+1); _asn1_set_name((yyval.node),(yyvsp[-1].str));} -#line 1802 "ASN1.c" /* yacc.c:1646 */ +#line 1804 "ASN1.c" /* yacc.c:1646 */ break; case 45: #line 250 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 1808 "ASN1.c" /* yacc.c:1646 */ +#line 1810 "ASN1.c" /* yacc.c:1646 */ break; case 46: #line 251 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[-1].node);} -#line 1814 "ASN1.c" /* yacc.c:1646 */ +#line 1816 "ASN1.c" /* yacc.c:1646 */ break; case 47: #line 254 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_GENERALSTRING);} -#line 1820 "ASN1.c" /* yacc.c:1646 */ +#line 1822 "ASN1.c" /* yacc.c:1646 */ break; case 48: #line 255 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_GENERALSTRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 1827 "ASN1.c" /* yacc.c:1646 */ +#line 1829 "ASN1.c" /* yacc.c:1646 */ break; case 49: #line 259 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_NUMERIC_STRING|CONST_UNIVERSAL);} -#line 1833 "ASN1.c" /* yacc.c:1646 */ +#line 1835 "ASN1.c" /* yacc.c:1646 */ break; case 50: #line 260 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_NUMERIC_STRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 1840 "ASN1.c" /* yacc.c:1646 */ +#line 1842 "ASN1.c" /* yacc.c:1646 */ break; case 51: #line 264 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IA5_STRING);} -#line 1846 "ASN1.c" /* yacc.c:1646 */ +#line 1848 "ASN1.c" /* yacc.c:1646 */ break; case 52: #line 265 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IA5_STRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 1853 "ASN1.c" /* yacc.c:1646 */ +#line 1855 "ASN1.c" /* yacc.c:1646 */ break; case 53: #line 269 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TELETEX_STRING);} -#line 1859 "ASN1.c" /* yacc.c:1646 */ +#line 1861 "ASN1.c" /* yacc.c:1646 */ break; case 54: #line 270 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TELETEX_STRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 1866 "ASN1.c" /* yacc.c:1646 */ +#line 1868 "ASN1.c" /* yacc.c:1646 */ break; case 55: #line 274 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_PRINTABLE_STRING);} -#line 1872 "ASN1.c" /* yacc.c:1646 */ +#line 1874 "ASN1.c" /* yacc.c:1646 */ break; case 56: #line 275 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_PRINTABLE_STRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 1879 "ASN1.c" /* yacc.c:1646 */ +#line 1881 "ASN1.c" /* yacc.c:1646 */ break; case 57: #line 279 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UNIVERSAL_STRING);} -#line 1885 "ASN1.c" /* yacc.c:1646 */ +#line 1887 "ASN1.c" /* yacc.c:1646 */ break; case 58: #line 280 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UNIVERSAL_STRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 1892 "ASN1.c" /* yacc.c:1646 */ +#line 1894 "ASN1.c" /* yacc.c:1646 */ break; case 59: #line 284 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BMP_STRING);} -#line 1898 "ASN1.c" /* yacc.c:1646 */ +#line 1900 "ASN1.c" /* yacc.c:1646 */ break; case 60: #line 285 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BMP_STRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 1905 "ASN1.c" /* yacc.c:1646 */ +#line 1907 "ASN1.c" /* yacc.c:1646 */ break; case 61: #line 289 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UTF8_STRING);} -#line 1911 "ASN1.c" /* yacc.c:1646 */ +#line 1913 "ASN1.c" /* yacc.c:1646 */ break; case 62: #line 290 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UTF8_STRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 1918 "ASN1.c" /* yacc.c:1646 */ +#line 1920 "ASN1.c" /* yacc.c:1646 */ break; case 63: #line 294 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_VISIBLE_STRING);} -#line 1924 "ASN1.c" /* yacc.c:1646 */ +#line 1926 "ASN1.c" /* yacc.c:1646 */ break; case 64: #line 295 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_VISIBLE_STRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 1931 "ASN1.c" /* yacc.c:1646 */ +#line 1933 "ASN1.c" /* yacc.c:1646 */ break; case 65: #line 299 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OCTET_STRING);} -#line 1937 "ASN1.c" /* yacc.c:1646 */ +#line 1939 "ASN1.c" /* yacc.c:1646 */ break; case 66: #line 300 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OCTET_STRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 1944 "ASN1.c" /* yacc.c:1646 */ +#line 1946 "ASN1.c" /* yacc.c:1646 */ break; case 67: @@ -1948,59 +1950,59 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT); _asn1_set_name((yyval.node),(yyvsp[-3].str)); _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} -#line 1952 "ASN1.c" /* yacc.c:1646 */ +#line 1954 "ASN1.c" /* yacc.c:1646 */ break; case 68: #line 309 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 1958 "ASN1.c" /* yacc.c:1646 */ +#line 1960 "ASN1.c" /* yacc.c:1646 */ break; case 69: #line 310 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[-2].node); _asn1_set_right(_asn1_get_last_right((yyvsp[-2].node)),(yyvsp[0].node));} -#line 1965 "ASN1.c" /* yacc.c:1646 */ +#line 1967 "ASN1.c" /* yacc.c:1646 */ break; case 70: #line 314 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BIT_STRING);} -#line 1971 "ASN1.c" /* yacc.c:1646 */ +#line 1973 "ASN1.c" /* yacc.c:1646 */ break; case 71: #line 315 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BIT_STRING|CONST_SIZE);} -#line 1977 "ASN1.c" /* yacc.c:1646 */ +#line 1979 "ASN1.c" /* yacc.c:1646 */ break; case 72: #line 317 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BIT_STRING|CONST_LIST); _asn1_set_down((yyval.node),(yyvsp[-1].node));} -#line 1984 "ASN1.c" /* yacc.c:1646 */ +#line 1986 "ASN1.c" /* yacc.c:1646 */ break; case 73: #line 322 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_ENUMERATED|CONST_LIST); _asn1_set_down((yyval.node),(yyvsp[-1].node));} -#line 1991 "ASN1.c" /* yacc.c:1646 */ +#line 1993 "ASN1.c" /* yacc.c:1646 */ break; case 74: #line 327 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID);} -#line 1997 "ASN1.c" /* yacc.c:1646 */ +#line 1999 "ASN1.c" /* yacc.c:1646 */ break; case 75: #line 330 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IDENTIFIER); _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);} -#line 2004 "ASN1.c" /* yacc.c:1646 */ +#line 2006 "ASN1.c" /* yacc.c:1646 */ break; case 76: @@ -2008,133 +2010,133 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IDENTIFIER|CONST_SIZE); _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 2012 "ASN1.c" /* yacc.c:1646 */ +#line 2014 "ASN1.c" /* yacc.c:1646 */ break; case 77: #line 335 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2018 "ASN1.c" /* yacc.c:1646 */ +#line 2020 "ASN1.c" /* yacc.c:1646 */ break; case 78: #line 336 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2024 "ASN1.c" /* yacc.c:1646 */ +#line 2026 "ASN1.c" /* yacc.c:1646 */ break; case 79: #line 337 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2030 "ASN1.c" /* yacc.c:1646 */ +#line 2032 "ASN1.c" /* yacc.c:1646 */ break; case 81: #line 339 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2036 "ASN1.c" /* yacc.c:1646 */ +#line 2038 "ASN1.c" /* yacc.c:1646 */ break; case 82: #line 340 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2042 "ASN1.c" /* yacc.c:1646 */ +#line 2044 "ASN1.c" /* yacc.c:1646 */ break; case 83: #line 341 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2048 "ASN1.c" /* yacc.c:1646 */ +#line 2050 "ASN1.c" /* yacc.c:1646 */ break; case 84: #line 342 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2054 "ASN1.c" /* yacc.c:1646 */ +#line 2056 "ASN1.c" /* yacc.c:1646 */ break; case 85: #line 343 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2060 "ASN1.c" /* yacc.c:1646 */ +#line 2062 "ASN1.c" /* yacc.c:1646 */ break; case 86: #line 344 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2066 "ASN1.c" /* yacc.c:1646 */ +#line 2068 "ASN1.c" /* yacc.c:1646 */ break; case 87: #line 345 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2072 "ASN1.c" /* yacc.c:1646 */ +#line 2074 "ASN1.c" /* yacc.c:1646 */ break; case 88: #line 346 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2078 "ASN1.c" /* yacc.c:1646 */ +#line 2080 "ASN1.c" /* yacc.c:1646 */ break; case 89: #line 347 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2084 "ASN1.c" /* yacc.c:1646 */ +#line 2086 "ASN1.c" /* yacc.c:1646 */ break; case 90: #line 348 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2090 "ASN1.c" /* yacc.c:1646 */ +#line 2092 "ASN1.c" /* yacc.c:1646 */ break; case 91: #line 349 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2096 "ASN1.c" /* yacc.c:1646 */ +#line 2098 "ASN1.c" /* yacc.c:1646 */ break; case 92: #line 350 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2102 "ASN1.c" /* yacc.c:1646 */ +#line 2104 "ASN1.c" /* yacc.c:1646 */ break; case 93: #line 351 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2108 "ASN1.c" /* yacc.c:1646 */ +#line 2110 "ASN1.c" /* yacc.c:1646 */ break; case 94: #line 352 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2114 "ASN1.c" /* yacc.c:1646 */ +#line 2116 "ASN1.c" /* yacc.c:1646 */ break; case 95: #line 353 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2120 "ASN1.c" /* yacc.c:1646 */ +#line 2122 "ASN1.c" /* yacc.c:1646 */ break; case 96: #line 354 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2126 "ASN1.c" /* yacc.c:1646 */ +#line 2128 "ASN1.c" /* yacc.c:1646 */ break; case 97: #line 355 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_NULL);} -#line 2132 "ASN1.c" /* yacc.c:1646 */ +#line 2134 "ASN1.c" /* yacc.c:1646 */ break; case 98: #line 358 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2138 "ASN1.c" /* yacc.c:1646 */ +#line 2140 "ASN1.c" /* yacc.c:1646 */ break; case 99: @@ -2142,13 +2144,13 @@ yyreduce: {(yyval.node)=_asn1_mod_type((yyvsp[0].node),CONST_TAG); _asn1_set_right((yyvsp[-1].node),_asn1_get_down((yyval.node))); _asn1_set_down((yyval.node),(yyvsp[-1].node));} -#line 2146 "ASN1.c" /* yacc.c:1646 */ +#line 2148 "ASN1.c" /* yacc.c:1646 */ break; case 100: #line 364 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2152 "ASN1.c" /* yacc.c:1646 */ +#line 2154 "ASN1.c" /* yacc.c:1646 */ break; case 101: @@ -2156,46 +2158,46 @@ yyreduce: {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_DEFAULT); _asn1_set_right((yyvsp[0].node),_asn1_get_down((yyval.node))); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 2160 "ASN1.c" /* yacc.c:1646 */ +#line 2162 "ASN1.c" /* yacc.c:1646 */ break; case 102: #line 368 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_OPTION);} -#line 2166 "ASN1.c" /* yacc.c:1646 */ +#line 2168 "ASN1.c" /* yacc.c:1646 */ break; case 103: #line 371 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_set_name((yyvsp[0].node),(yyvsp[-1].str));} -#line 2172 "ASN1.c" /* yacc.c:1646 */ +#line 2174 "ASN1.c" /* yacc.c:1646 */ break; case 104: #line 374 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2178 "ASN1.c" /* yacc.c:1646 */ +#line 2180 "ASN1.c" /* yacc.c:1646 */ break; case 105: #line 375 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[-2].node); _asn1_set_right(_asn1_get_last_right((yyvsp[-2].node)),(yyvsp[0].node));} -#line 2185 "ASN1.c" /* yacc.c:1646 */ +#line 2187 "ASN1.c" /* yacc.c:1646 */ break; case 106: #line 379 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SEQUENCE); _asn1_set_down((yyval.node),(yyvsp[-1].node));} -#line 2192 "ASN1.c" /* yacc.c:1646 */ +#line 2194 "ASN1.c" /* yacc.c:1646 */ break; case 107: #line 381 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SEQUENCE_OF); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 2199 "ASN1.c" /* yacc.c:1646 */ +#line 2201 "ASN1.c" /* yacc.c:1646 */ break; case 108: @@ -2203,21 +2205,21 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SEQUENCE_OF|CONST_SIZE); _asn1_set_right((yyvsp[-2].node),(yyvsp[0].node)); _asn1_set_down((yyval.node),(yyvsp[-2].node));} -#line 2207 "ASN1.c" /* yacc.c:1646 */ +#line 2209 "ASN1.c" /* yacc.c:1646 */ break; case 109: #line 388 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SET); _asn1_set_down((yyval.node),(yyvsp[-1].node));} -#line 2214 "ASN1.c" /* yacc.c:1646 */ +#line 2216 "ASN1.c" /* yacc.c:1646 */ break; case 110: #line 390 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SET_OF); _asn1_set_down((yyval.node),(yyvsp[0].node));} -#line 2221 "ASN1.c" /* yacc.c:1646 */ +#line 2223 "ASN1.c" /* yacc.c:1646 */ break; case 111: @@ -2225,20 +2227,20 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SET_OF|CONST_SIZE); _asn1_set_right((yyvsp[-2].node),(yyvsp[0].node)); _asn1_set_down((yyval.node),(yyvsp[-2].node));} -#line 2229 "ASN1.c" /* yacc.c:1646 */ +#line 2231 "ASN1.c" /* yacc.c:1646 */ break; case 112: #line 397 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CHOICE); _asn1_set_down((yyval.node),(yyvsp[-1].node));} -#line 2236 "ASN1.c" /* yacc.c:1646 */ +#line 2238 "ASN1.c" /* yacc.c:1646 */ break; case 113: #line 401 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_ANY);} -#line 2242 "ASN1.c" /* yacc.c:1646 */ +#line 2244 "ASN1.c" /* yacc.c:1646 */ break; case 114: @@ -2246,19 +2248,19 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_ANY|CONST_DEFINED_BY); _asn1_set_down((yyval.node),_asn1_add_static_node(ASN1_ETYPE_CONSTANT)); _asn1_set_name(_asn1_get_down((yyval.node)),(yyvsp[0].str));} -#line 2250 "ASN1.c" /* yacc.c:1646 */ +#line 2252 "ASN1.c" /* yacc.c:1646 */ break; case 115: #line 407 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_set_name((yyvsp[0].node),(yyvsp[-2].str));} -#line 2256 "ASN1.c" /* yacc.c:1646 */ +#line 2258 "ASN1.c" /* yacc.c:1646 */ break; case 116: #line 409 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_set_name((yyvsp[0].node), last_error_token);} -#line 2262 "ASN1.c" /* yacc.c:1646 */ +#line 2264 "ASN1.c" /* yacc.c:1646 */ break; case 117: @@ -2266,7 +2268,7 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID|CONST_ASSIGN); _asn1_set_name((yyval.node),(yyvsp[-6].str)); _asn1_set_down((yyval.node),(yyvsp[-1].node));} -#line 2270 "ASN1.c" /* yacc.c:1646 */ +#line 2272 "ASN1.c" /* yacc.c:1646 */ break; case 118: @@ -2275,7 +2277,7 @@ yyreduce: _asn1_set_name((yyval.node),(yyvsp[-5].str)); _asn1_set_value((yyval.node),(yyvsp[-4].str),strlen((yyvsp[-4].str))+1); _asn1_set_down((yyval.node),(yyvsp[-1].node));} -#line 2279 "ASN1.c" /* yacc.c:1646 */ +#line 2281 "ASN1.c" /* yacc.c:1646 */ break; case 119: @@ -2283,32 +2285,32 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER|CONST_ASSIGN); _asn1_set_name((yyval.node),(yyvsp[-3].str)); _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);} -#line 2287 "ASN1.c" /* yacc.c:1646 */ +#line 2289 "ASN1.c" /* yacc.c:1646 */ break; case 120: #line 427 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2293 "ASN1.c" /* yacc.c:1646 */ +#line 2295 "ASN1.c" /* yacc.c:1646 */ break; case 121: #line 428 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2299 "ASN1.c" /* yacc.c:1646 */ +#line 2301 "ASN1.c" /* yacc.c:1646 */ break; case 122: #line 431 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[0].node);} -#line 2305 "ASN1.c" /* yacc.c:1646 */ +#line 2307 "ASN1.c" /* yacc.c:1646 */ break; case 123: #line 432 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=(yyvsp[-1].node); _asn1_set_right(_asn1_get_last_right((yyvsp[-1].node)),(yyvsp[0].node));} -#line 2312 "ASN1.c" /* yacc.c:1646 */ +#line 2314 "ASN1.c" /* yacc.c:1646 */ break; case 124: @@ -2316,37 +2318,37 @@ yyreduce: {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID); _asn1_set_down((yyval.node),(yyvsp[-1].node)); _asn1_set_name((yyval.node),(yyvsp[-3].str));} -#line 2320 "ASN1.c" /* yacc.c:1646 */ +#line 2322 "ASN1.c" /* yacc.c:1646 */ break; case 125: #line 439 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID); _asn1_set_name((yyval.node),(yyvsp[-2].str));} -#line 2327 "ASN1.c" /* yacc.c:1646 */ +#line 2329 "ASN1.c" /* yacc.c:1646 */ break; case 126: #line 441 "ASN1.y" /* yacc.c:1646 */ {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID); _asn1_set_name((yyval.node),(yyvsp[0].str));} -#line 2334 "ASN1.c" /* yacc.c:1646 */ +#line 2336 "ASN1.c" /* yacc.c:1646 */ break; case 127: #line 465 "ASN1.y" /* yacc.c:1646 */ {(yyval.constant)=CONST_EXPLICIT;} -#line 2340 "ASN1.c" /* yacc.c:1646 */ +#line 2342 "ASN1.c" /* yacc.c:1646 */ break; case 128: #line 466 "ASN1.y" /* yacc.c:1646 */ {(yyval.constant)=CONST_IMPLICIT;} -#line 2346 "ASN1.c" /* yacc.c:1646 */ +#line 2348 "ASN1.c" /* yacc.c:1646 */ break; -#line 2350 "ASN1.c" /* yacc.c:1646 */ +#line 2352 "ASN1.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -2729,7 +2731,7 @@ _asn1_create_errorDescription (int error, char *error_desc) case ASN1_NAME_TOO_LONG: snprintf (error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, "%s:%u: name too long (more than %u characters)", file_name, - line_number, ASN1_MAX_NAME_SIZE); + line_number, (unsigned)ASN1_MAX_NAME_SIZE); break; case ASN1_IDENTIFIER_NOT_FOUND: snprintf (error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, @@ -2757,7 +2759,7 @@ _asn1_create_errorDescription (int error, char *error_desc) * * Returns: %ASN1_SUCCESS if the file has a correct syntax and every * identifier is known, %ASN1_ELEMENT_NOT_EMPTY if @definitions not - * %NULL, %ASN1_FILE_NOT_FOUND if an error occured while + * %NULL, %ASN1_FILE_NOT_FOUND if an error occurred while * opening @file, %ASN1_SYNTAX_ERROR if the syntax is not * correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is an * identifier that is not defined, %ASN1_NAME_TOO_LONG if in the @@ -2845,7 +2847,7 @@ asn1_parser2tree (const char *file, asn1_node * definitions, * will be "xx_asn1_tab". * * Returns: %ASN1_SUCCESS if the file has a correct syntax and every - * identifier is known, %ASN1_FILE_NOT_FOUND if an error occured + * identifier is known, %ASN1_FILE_NOT_FOUND if an error occurred * while opening @inputFileName, %ASN1_SYNTAX_ERROR if the syntax is * not correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is * an identifier that is not defined, %ASN1_NAME_TOO_LONG if in the @@ -57,7 +57,7 @@ static int _asn1_yylex(void); /* Prefix symbols and functions with _asn1_ */ /* %define parse.lac full */ %error-verbose -%name-prefix="_asn1_yy" +%name-prefix "_asn1_yy" %union { unsigned int constant; @@ -621,7 +621,7 @@ _asn1_create_errorDescription (int error, char *error_desc) case ASN1_NAME_TOO_LONG: snprintf (error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, "%s:%u: name too long (more than %u characters)", file_name, - line_number, ASN1_MAX_NAME_SIZE); + line_number, (unsigned)ASN1_MAX_NAME_SIZE); break; case ASN1_IDENTIFIER_NOT_FOUND: snprintf (error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, @@ -649,7 +649,7 @@ _asn1_create_errorDescription (int error, char *error_desc) * * Returns: %ASN1_SUCCESS if the file has a correct syntax and every * identifier is known, %ASN1_ELEMENT_NOT_EMPTY if @definitions not - * %NULL, %ASN1_FILE_NOT_FOUND if an error occured while + * %NULL, %ASN1_FILE_NOT_FOUND if an error occurred while * opening @file, %ASN1_SYNTAX_ERROR if the syntax is not * correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is an * identifier that is not defined, %ASN1_NAME_TOO_LONG if in the @@ -737,7 +737,7 @@ asn1_parser2tree (const char *file, asn1_node * definitions, * will be "xx_asn1_tab". * * Returns: %ASN1_SUCCESS if the file has a correct syntax and every - * identifier is known, %ASN1_FILE_NOT_FOUND if an error occured + * identifier is known, %ASN1_FILE_NOT_FOUND if an error occurred * while opening @inputFileName, %ASN1_SYNTAX_ERROR if the syntax is * not correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is * an identifier that is not defined, %ASN1_NAME_TOO_LONG if in the diff --git a/lib/Makefile.in b/lib/Makefile.in index 3dc3c0d..e09a7e8 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -132,6 +132,7 @@ am__aclocal_m4_deps = $(top_srcdir)/lib/glm4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/largefile.m4 \ + $(top_srcdir)/gl/m4/limits-h.m4 \ $(top_srcdir)/gl/m4/longlong.m4 $(top_srcdir)/gl/m4/lseek.m4 \ $(top_srcdir)/gl/m4/malloc.m4 \ $(top_srcdir)/gl/m4/manywarnings.m4 \ @@ -154,10 +155,10 @@ am__aclocal_m4_deps = $(top_srcdir)/lib/glm4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/version-etc.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/warnings.m4 $(top_srcdir)/gl/m4/wchar_t.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/gl/m4/wint_t.m4 $(top_srcdir)/m4/gtk-doc.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/m4/update-header-version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -473,6 +474,7 @@ GNULIB_MKTIME = @GNULIB_MKTIME@ GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@ GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@ GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -489,6 +491,7 @@ GNULIB_PUTCHAR = @GNULIB_PUTCHAR@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_PUTS = @GNULIB_PUTS@ GNULIB_PWRITE = @GNULIB_PWRITE@ +GNULIB_QSORT_R = @GNULIB_QSORT_R@ GNULIB_RANDOM = @GNULIB_RANDOM@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ @@ -537,6 +540,7 @@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@ GNULIB_TIMEGM = @GNULIB_TIMEGM@ GNULIB_TIME_R = @GNULIB_TIME_R@ +GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ @@ -565,6 +569,7 @@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ @@ -577,6 +582,7 @@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -630,6 +636,7 @@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ @@ -655,6 +662,7 @@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ +HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ @@ -694,6 +702,7 @@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ +HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -723,6 +732,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIMITS_H = @LIMITS_H@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ @@ -735,6 +745,7 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ @@ -748,6 +759,7 @@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ +NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ @@ -841,9 +853,11 @@ REPLACE_PTSNAME = @REPLACE_PTSNAME@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ +REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ @@ -872,6 +886,7 @@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ +REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ @@ -900,13 +915,13 @@ STRIP = @STRIP@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ +UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ -WERROR_CFLAGS = @WERROR_CFLAGS@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ diff --git a/lib/decoding.c b/lib/decoding.c index 2cd9ac3..c2e6027 100644 --- a/lib/decoding.c +++ b/lib/decoding.c @@ -114,7 +114,7 @@ asn1_get_length_der (const unsigned char *der, int der_len, int *len) k = der[0] & 0x7F; punt = 1; if (k) - { /* definite length method */ + { /* definite length method */ ans = 0; while (punt <= k && punt < der_len) { @@ -154,7 +154,7 @@ asn1_get_length_der (const unsigned char *der, int der_len, int *len) * @der_len: Length of DER data to decode. * @cls: Output variable containing decoded class. * @len: Output variable containing the length of the DER TAG data. - * @tag: Output variable containing the decoded tag. + * @tag: Output variable containing the decoded tag (may be %NULL). * * Decode the class and TAG from DER code. * @@ -237,9 +237,9 @@ asn1_get_length_ber (const unsigned char *ber, int ber_len, int *len) long err; ret = asn1_get_length_der (ber, ber_len, len); - if (ret == -1) + if (ret == -1 && ber_len > 1) { /* indefinite length method */ - err = _asn1_get_indefinite_length_string (ber + 1, ber_len, &ret); + err = _asn1_get_indefinite_length_string (ber + 1, ber_len-1, &ret); if (err != ASN1_SUCCESS) return -3; } @@ -1141,8 +1141,8 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len, if (result != ASN1_SUCCESS) { warn(); - goto cleanup; - } + goto cleanup; + } DECR_LEN(ider_len, len2); @@ -1186,15 +1186,15 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len, dflags |= DECODE_FLAG_INDEFINITE; result = _asn1_decode_simple_ber(type_field (p->type), der+counter, ider_len, &ptmp, &vlen, &ber_len, dflags); - if (result != ASN1_SUCCESS) + if (result != ASN1_SUCCESS) { warn(); goto cleanup; } - DECR_LEN(ider_len, ber_len); + DECR_LEN(ider_len, ber_len); - _asn1_set_value_lv (p, ptmp, vlen); + _asn1_set_value_lv (p, ptmp, vlen); counter += ber_len; free(ptmp); @@ -1434,8 +1434,8 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len, if (result != ASN1_SUCCESS) { warn(); - goto cleanup; - } + goto cleanup; + } DECR_LEN(ider_len, len2); _asn1_set_value_lv (p, der + counter, len2); @@ -1470,7 +1470,7 @@ asn1_der_decoding2 (asn1_node *element, const void *ider, int *max_ider_len, if (p) { - p->end = counter - 1; + p->end = counter - 1; } if (p == node && move != DOWN) @@ -2250,8 +2250,8 @@ _asn1_decode_simple_ber (unsigned int etype, const unsigned char *der, if (p[0] == 0 && p[1] == 0) /* EOC */ { if (ber_len) *ber_len += 2; - break; - } + break; + } /* no EOC */ der_len += 2; diff --git a/lib/element.c b/lib/element.c index b7a0905..756e41a 100644 --- a/lib/element.c +++ b/lib/element.c @@ -753,7 +753,8 @@ asn1_write_value (asn1_node node_root, const char *name, * %ASN1_VALUE_NOT_FOUND if there isn't any value for the element * selected, and %ASN1_MEM_ERROR if The value vector isn't big enough * to store the result, and in this case @len will contain the number of - * bytes needed. + * bytes needed. On the occasion that the stored data are of zero-length + * this function may return %ASN1_SUCCESS even if the provided @len is zero. **/ int asn1_read_value (asn1_node root, const char *name, void *ivalue, int *len) @@ -826,7 +827,8 @@ asn1_read_value (asn1_node root, const char *name, void *ivalue, int *len) * %ASN1_VALUE_NOT_FOUND if there isn't any value for the element * selected, and %ASN1_MEM_ERROR if The value vector isn't big enough * to store the result, and in this case @len will contain the number of - * bytes needed. + * bytes needed. On the occasion that the stored data are of zero-length + * this function may return %ASN1_SUCCESS even if the provided @len is zero. **/ int asn1_read_value_type (asn1_node root, const char *name, void *ivalue, @@ -932,7 +934,7 @@ asn1_read_value_type (asn1_node root, const char *name, void *ivalue, { *len = 0; if (value) - value[0] = 0; + value[0] = 0; p = node->down; while (p) { diff --git a/lib/gllib/Makefile.am b/lib/gllib/Makefile.am index 96932d1..d395304 100644 --- a/lib/gllib/Makefile.am +++ b/lib/gllib/Makefile.am @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2017 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib/gllib --m4-base=lib/glm4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files hash-pjw-bare intprops lib-symbol-versions lib-symbol-visibility minmax stdint strverscmp +# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib/gllib --m4-base=lib/glm4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files hash-pjw-bare intprops lib-symbol-versions lib-symbol-visibility minmax stdint strverscmp AUTOMAKE_OPTIONS = 1.9.6 gnits @@ -82,6 +82,34 @@ AM_CFLAGS += $(CFLAG_VISIBILITY) ## end gnulib module lib-symbol-visibility +## begin gnulib module limits-h + +BUILT_SOURCES += $(LIMITS_H) + +# We need the following in order to create <limits.h> when the system +# doesn't have one that is compatible with GNU. +if GL_GENERATE_LIMITS_H +limits.h: limits.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL_LGL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ + < $(srcdir)/limits.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +limits.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += limits.h limits.h-t + +EXTRA_DIST += limits.in.h + +## end gnulib module limits-h + ## begin gnulib module minmax libgnu_la_SOURCES += minmax.h @@ -172,6 +200,7 @@ stddef.h: stddef.in.h $(top_builddir)/config.status -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ + -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ < $(srcdir)/stddef.in.h; \ @@ -203,6 +232,7 @@ stdint.h: stdint.in.h $(top_builddir)/config.status -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ + -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ @@ -224,6 +254,7 @@ stdint.h: stdint.in.h $(top_builddir)/config.status -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ + -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ < $(srcdir)/stdint.in.h; \ } > $@-t && \ mv $@-t $@ @@ -371,6 +402,13 @@ EXTRA_DIST += sys_types.in.h ## end gnulib module sys_types +## begin gnulib module verify + + +EXTRA_DIST += verify.h + +## end gnulib module verify + mostlyclean-local: mostlyclean-generic @for dir in '' $(MOSTLYCLEANDIRS); do \ diff --git a/lib/gllib/Makefile.in b/lib/gllib/Makefile.in index d6ecc9d..ba53d4f 100644 --- a/lib/gllib/Makefile.in +++ b/lib/gllib/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2017 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib/gllib --m4-base=lib/glm4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files hash-pjw-bare intprops lib-symbol-versions lib-symbol-visibility minmax stdint strverscmp +# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib/gllib --m4-base=lib/glm4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files hash-pjw-bare intprops lib-symbol-versions lib-symbol-visibility minmax stdint strverscmp @@ -136,6 +136,7 @@ am__aclocal_m4_deps = $(top_srcdir)/lib/glm4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/include_next.m4 \ $(top_srcdir)/gl/m4/largefile.m4 \ + $(top_srcdir)/gl/m4/limits-h.m4 \ $(top_srcdir)/gl/m4/longlong.m4 $(top_srcdir)/gl/m4/lseek.m4 \ $(top_srcdir)/gl/m4/malloc.m4 \ $(top_srcdir)/gl/m4/manywarnings.m4 \ @@ -158,10 +159,10 @@ am__aclocal_m4_deps = $(top_srcdir)/lib/glm4/gnulib-comp.m4 \ $(top_srcdir)/gl/m4/version-etc.m4 \ $(top_srcdir)/gl/m4/warn-on-use.m4 \ $(top_srcdir)/gl/m4/warnings.m4 $(top_srcdir)/gl/m4/wchar_t.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/gl/m4/wint_t.m4 $(top_srcdir)/m4/gtk-doc.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/m4/update-header-version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -436,6 +437,7 @@ GNULIB_MKTIME = @GNULIB_MKTIME@ GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@ GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@ GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -452,6 +454,7 @@ GNULIB_PUTCHAR = @GNULIB_PUTCHAR@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_PUTS = @GNULIB_PUTS@ GNULIB_PWRITE = @GNULIB_PWRITE@ +GNULIB_QSORT_R = @GNULIB_QSORT_R@ GNULIB_RANDOM = @GNULIB_RANDOM@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ @@ -500,6 +503,7 @@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@ GNULIB_TIMEGM = @GNULIB_TIMEGM@ GNULIB_TIME_R = @GNULIB_TIME_R@ +GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ @@ -528,6 +532,7 @@ GTKDOC_CHECK = @GTKDOC_CHECK@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ @@ -540,6 +545,7 @@ HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -593,6 +599,7 @@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ @@ -618,6 +625,7 @@ HAVE_PREAD = @HAVE_PREAD@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ +HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ @@ -657,6 +665,7 @@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ +HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -686,6 +695,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIMITS_H = @LIMITS_H@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ @@ -698,6 +708,7 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_STDARG_H = @NEXT_AS_FIRST_DIRECTIVE_STDARG_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ @@ -711,6 +722,7 @@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ +NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_STDARG_H = @NEXT_STDARG_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ @@ -804,9 +816,11 @@ REPLACE_PTSNAME = @REPLACE_PTSNAME@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ +REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ @@ -835,6 +849,7 @@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ +REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ @@ -863,13 +878,13 @@ STRIP = @STRIP@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ +UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VALGRIND = @VALGRIND@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ -WERROR_CFLAGS = @WERROR_CFLAGS@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ @@ -943,10 +958,11 @@ SUBDIRS = noinst_HEADERS = noinst_LIBRARIES = noinst_LTLIBRARIES = libgnu.la -EXTRA_DIST = intprops.h $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ +EXTRA_DIST = intprops.h limits.in.h \ + $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ $(top_srcdir)/build-aux/snippet/c++defs.h \ $(top_srcdir)/build-aux/snippet/warn-on-use.h stddef.in.h \ - stdint.in.h string.in.h strverscmp.c sys_types.in.h + stdint.in.h string.in.h strverscmp.c sys_types.in.h verify.h # The BUILT_SOURCES created by this Makefile snippet are not used via #include # statements but through direct file reference. Therefore this snippet must be @@ -957,13 +973,13 @@ EXTRA_DIST = intprops.h $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ # statements but through direct file reference. Therefore this snippet must be # present in all Makefile.am that need it. This is ensured by the applicability # 'all' defined above. -BUILT_SOURCES = arg-nonnull.h c++defs.h warn-on-use.h $(STDDEF_H) \ - $(STDINT_H) string.h sys/types.h +BUILT_SOURCES = $(LIMITS_H) arg-nonnull.h c++defs.h warn-on-use.h \ + $(STDDEF_H) $(STDINT_H) string.h sys/types.h SUFFIXES = -MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ - c++defs.h c++defs.h-t warn-on-use.h warn-on-use.h-t stddef.h \ - stddef.h-t stdint.h stdint.h-t string.h string.h-t sys/types.h \ - sys/types.h-t +MOSTLYCLEANFILES = core *.stackdump limits.h limits.h-t arg-nonnull.h \ + arg-nonnull.h-t c++defs.h c++defs.h-t warn-on-use.h \ + warn-on-use.h-t stddef.h stddef.h-t stdint.h stdint.h-t \ + string.h string.h-t sys/types.h sys/types.h-t MOSTLYCLEANDIRS = CLEANFILES = DISTCLEANFILES = @@ -1363,6 +1379,22 @@ uninstall-am: .PRECIOUS: Makefile + +# We need the following in order to create <limits.h> when the system +# doesn't have one that is compatible with GNU. +@GL_GENERATE_LIMITS_H_TRUE@limits.h: limits.in.h $(top_builddir)/config.status +@GL_GENERATE_LIMITS_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_LIMITS_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ +@GL_GENERATE_LIMITS_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL_LGL|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ < $(srcdir)/limits.in.h; \ +@GL_GENERATE_LIMITS_H_TRUE@ } > $@-t && \ +@GL_GENERATE_LIMITS_H_TRUE@ mv $@-t $@ +@GL_GENERATE_LIMITS_H_FALSE@limits.h: $(top_builddir)/config.status +@GL_GENERATE_LIMITS_H_FALSE@ rm -f $@ # The arg-nonnull.h that gets inserted into generated .h files is the same as # build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut # off. @@ -1400,6 +1432,7 @@ warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ +@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ < $(srcdir)/stddef.in.h; \ @@ -1419,6 +1452,7 @@ warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h @GL_GENERATE_STDINT_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ @@ -1440,6 +1474,7 @@ warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ < $(srcdir)/stdint.in.h; \ @GL_GENERATE_STDINT_H_TRUE@ } > $@-t && \ @GL_GENERATE_STDINT_H_TRUE@ mv $@-t $@ diff --git a/lib/gllib/hash-pjw-bare.c b/lib/gllib/hash-pjw-bare.c index 5634f49..df98147 100644 --- a/lib/gllib/hash-pjw-bare.c +++ b/lib/gllib/hash-pjw-bare.c @@ -1,6 +1,6 @@ /* hash-pjw-bare.c -- compute a hash value from a provided buffer. - Copyright (C) 2012-2014 Free Software Foundation, Inc. + Copyright (C) 2012-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/lib/gllib/hash-pjw-bare.h b/lib/gllib/hash-pjw-bare.h index f4b08fe..7b6d92e 100644 --- a/lib/gllib/hash-pjw-bare.h +++ b/lib/gllib/hash-pjw-bare.h @@ -1,5 +1,5 @@ /* hash-pjw-bare.h -- declaration for a simple hash function - Copyright (C) 2012-2014 Free Software Foundation, Inc. + Copyright (C) 2012-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -20,5 +20,5 @@ and return the hash code. Note that unlike hash_pjw(), it does not return it modulo a table size. The result is platform dependent: it depends on the size of the 'size_t' - type and on the signedness of the 'char' type. */ + type. */ extern size_t hash_pjw_bare (const void *x, size_t n) _GL_ATTRIBUTE_PURE; diff --git a/lib/gllib/intprops.h b/lib/gllib/intprops.h index 6936ad5..eb06b69 100644 --- a/lib/gllib/intprops.h +++ b/lib/gllib/intprops.h @@ -1,10 +1,10 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001-2005, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2001-2017 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -21,9 +21,9 @@ #define _GL_INTPROPS_H #include <limits.h> +#include <verify.h> -/* Return an integer value, converted to the same type as the integer - expression E after integer type promotion. V is the unconverted value. */ +/* Return a value with the common real type of E and V and the value of V. */ #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) /* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see @@ -37,59 +37,72 @@ an integer. */ #define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) -/* True if negative values of the signed integer type T use two's - complement, ones' complement, or signed magnitude representation, - respectively. Much GNU code assumes two's complement, but some - people like to be portable to all possible C hosts. */ -#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) -#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) -#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) - -/* True if the signed integer expression E uses two's complement. */ -#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1) - -/* True if the arithmetic type T is signed. */ +/* True if the real type T is signed. */ #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) -/* Return 1 if the integer expression E, after integer promotion, has - a signed type. */ -#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) +/* Return 1 if the real expression E, after promotion, has a + signed or floating type. */ +#define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) -/* Minimum and maximum values for integer types and expressions. These - macros have undefined behavior if T is signed and has padding bits. - If this is a problem for you, please let us know how to fix it for - your host. */ +/* Minimum and maximum values for integer types and expressions. */ + +/* The width in bits of the integer type or expression T. + Padding bits are not supported; this is checked at compile-time below. */ +#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) /* The maximum and minimum values for the integer type T. */ -#define TYPE_MINIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) 0 \ - : TYPE_SIGNED_MAGNITUDE (t) \ - ? ~ (t) 0 \ - : ~ TYPE_MAXIMUM (t))) +#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t)) #define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) -1 \ - : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) + : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) /* The maximum and minimum values for the type of the expression E, after integer promotion. E should not have side effects. */ #define _GL_INT_MINIMUM(e) \ - (_GL_INT_SIGNED (e) \ - ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e) \ + (EXPR_SIGNED (e) \ + ? ~ _GL_SIGNED_INT_MAXIMUM (e) \ : _GL_INT_CONVERT (e, 0)) #define _GL_INT_MAXIMUM(e) \ - (_GL_INT_SIGNED (e) \ + (EXPR_SIGNED (e) \ ? _GL_SIGNED_INT_MAXIMUM (e) \ : _GL_INT_NEGATE_CONVERT (e, 1)) #define _GL_SIGNED_INT_MAXIMUM(e) \ - (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1) + (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1) +/* Work around OpenVMS incompatibility with C99. */ +#if !defined LLONG_MAX && defined __INT64_MAX +# define LLONG_MAX __INT64_MAX +# define LLONG_MIN __INT64_MIN +#endif + +/* This include file assumes that signed types are two's complement without + padding bits; the above macros have undefined behavior otherwise. + If this is a problem for you, please let us know how to fix it for your host. + As a sanity check, test the assumption for some signed types that + <limits.h> bounds. */ +verify (TYPE_MINIMUM (signed char) == SCHAR_MIN); +verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX); +verify (TYPE_MINIMUM (short int) == SHRT_MIN); +verify (TYPE_MAXIMUM (short int) == SHRT_MAX); +verify (TYPE_MINIMUM (int) == INT_MIN); +verify (TYPE_MAXIMUM (int) == INT_MAX); +verify (TYPE_MINIMUM (long int) == LONG_MIN); +verify (TYPE_MAXIMUM (long int) == LONG_MAX); +#ifdef LLONG_MAX +verify (TYPE_MINIMUM (long long int) == LLONG_MIN); +verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); +#endif +/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ +#ifdef UINT_WIDTH +verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); +#endif -/* Return 1 if the __typeof__ keyword works. This could be done by +/* Does the __typeof__ keyword work? This could be done by 'configure', but for now it's easier to do it by hand. */ -#if (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ +#if (2 <= __GNUC__ \ + || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ || (0x5110 <= __SUNPRO_C && !__STDC__)) # define _GL_HAVE___TYPEOF__ 1 #else @@ -118,8 +131,7 @@ signed, this macro may overestimate the true bound by one byte when applied to unsigned types of size 2, 4, 16, ... bytes. */ #define INT_STRLEN_BOUND(t) \ - (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \ - - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + _GL_SIGNED_TYPE_OR_EXPR (t)) /* Bound on buffer size needed to represent an integer type or expression T, @@ -224,24 +236,38 @@ ? (a) < (min) >> (b) \ : (max) >> (b) < (a)) +/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ +#define _GL_HAS_BUILTIN_OVERFLOW (5 <= __GNUC__) + +/* True if __builtin_add_overflow_p (A, B, C) works. */ +#define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__) /* The _GL*_OVERFLOW macros have the same restrictions as the *_RANGE_OVERFLOW macros, except that they do not assume that operands (e.g., A and B) have the same type as MIN and MAX. Instead, they assume that the result (e.g., A + B) has that type. */ -#define _GL_ADD_OVERFLOW(a, b, min, max) \ - ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ - : (a) < 0 ? (b) <= (a) + (b) \ - : (b) < 0 ? (a) <= (a) + (b) \ - : (a) + (b) < (b)) -#define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ - ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ - : (a) < 0 ? 1 \ - : (b) < 0 ? (a) - (b) <= (a) \ - : (a) < (b)) -#define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ - (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ - || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define _GL_ADD_OVERFLOW(a, b, min, max) \ + __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) +# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0) +# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0) +#else +# define _GL_ADD_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? (b) <= (a) + (b) \ + : (b) < 0 ? (a) <= (a) + (b) \ + : (a) + (b) < (b)) +# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? 1 \ + : (b) < 0 ? (a) - (b) <= (a) \ + : (a) < (b)) +# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ + || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) +#endif #define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ : (a) < 0 ? (b) <= (a) + (b) - 1 \ @@ -263,22 +289,29 @@ : (a) % - (b)) \ == 0) - -/* Integer overflow checks. +/* Check for integer overflow, and report low order bits of answer. The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators might not yield numerically correct answers due to arithmetic overflow. - They work correctly on all known practical hosts, and do not rely + The INT_<op>_WRAPV macros also store the low-order bits of the answer. + These macros work correctly on all known practical hosts, and do not rely on undefined behavior due to signed arithmetic overflow. - Example usage: + Example usage, assuming A and B are long int: - long int i = ...; - long int j = ...; - if (INT_MULTIPLY_OVERFLOW (i, j)) - printf ("multiply would overflow"); + if (INT_MULTIPLY_OVERFLOW (a, b)) + printf ("result would overflow\n"); else - printf ("product is %ld", i * j); + printf ("result is %ld (no overflow)\n", a * b); + + Example usage with WRAPV flavor: + + long int result; + bool overflow = INT_MULTIPLY_WRAPV (a, b, &result); + printf ("result is %ld (%s)\n", result, + overflow ? "after overflow" : "no overflow"); + + Restrictions on these macros: These macros do not check for all possible numerical problems or undefined or unspecified behavior: they do not check for division @@ -287,6 +320,9 @@ These macros may evaluate their arguments zero or multiple times, so the arguments should not have side effects. + The WRAPV macros are not constant expressions. They support only + +, binary -, and *. The result type must be signed. + These macros are tuned for their last argument being a constant. Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, @@ -296,8 +332,12 @@ _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) #define INT_SUBTRACT_OVERFLOW(a, b) \ _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) -#define INT_NEGATE_OVERFLOW(a) \ - INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) +#else +# define INT_NEGATE_OVERFLOW(a) \ + INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#endif #define INT_MULTIPLY_OVERFLOW(a, b) \ _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW) #define INT_DIVIDE_OVERFLOW(a, b) \ @@ -317,4 +357,102 @@ _GL_INT_MINIMUM (0 * (b) + (a)), \ _GL_INT_MAXIMUM (0 * (b) + (a))) +/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R. + Return 1 if the result overflows. See above for restrictions. */ +#define INT_ADD_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW) +#define INT_SUBTRACT_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, -, __builtin_sub_overflow, INT_SUBTRACT_OVERFLOW) +#define INT_MULTIPLY_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW) + +/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 + https://llvm.org/bugs/show_bug.cgi?id=25390 + For now, assume all versions of GCC-like compilers generate bogus + warnings for _Generic. This matters only for older compilers that + lack __builtin_add_overflow. */ +#if __GNUC__ +# define _GL__GENERIC_BOGUS 1 +#else +# define _GL__GENERIC_BOGUS 0 +#endif + +/* Store the low-order bits of A <op> B into *R, where OP specifies + the operation. BUILTIN is the builtin operation, and OVERFLOW the + overflow predicate. Return 1 if the result overflows. See above + for restrictions. */ +#if _GL_HAS_BUILTIN_OVERFLOW +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r) +#elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ + (_Generic \ + (*(r), \ + signed char: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + signed char, SCHAR_MIN, SCHAR_MAX), \ + short int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + short int, SHRT_MIN, SHRT_MAX), \ + int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX), \ + long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX), \ + long long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX))) +#else +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ + (sizeof *(r) == sizeof (signed char) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + signed char, SCHAR_MIN, SCHAR_MAX) \ + : sizeof *(r) == sizeof (short int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + short int, SHRT_MIN, SHRT_MAX) \ + : sizeof *(r) == sizeof (int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX) \ + : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow)) +# ifdef LLONG_MAX +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + (sizeof *(r) == sizeof (long int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX)) +# else +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) +# endif +#endif + +/* Store the low-order bits of A <op> B into *R, where the operation + is given by OP. Use the unsigned type UT for calculation to avoid + overflow problems. *R's type is T, with extremal values TMIN and + TMAX. T must be a signed integer type. Return 1 if the result + overflows. */ +#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ + (sizeof ((a) op (b)) < sizeof (t) \ + ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \ + : _GL_INT_OP_CALC1 (a, b, r, op, overflow, ut, t, tmin, tmax)) +#define _GL_INT_OP_CALC1(a, b, r, op, overflow, ut, t, tmin, tmax) \ + ((overflow (a, b) \ + || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \ + || (tmax) < ((a) op (b))) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0)) + +/* Return A <op> B, where the operation is given by OP. Use the + unsigned type UT for calculation to avoid overflow problems. + Convert the result to type T without overflow by subtracting TMIN + from large values before converting, and adding it afterwards. + Compilers can optimize all the operations except OP. */ +#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \ + (((ut) (a) op (ut) (b)) <= (tmax) \ + ? (t) ((ut) (a) op (ut) (b)) \ + : ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin))) + #endif /* _GL_INTPROPS_H */ diff --git a/lib/gllib/limits.in.h b/lib/gllib/limits.in.h new file mode 100644 index 0000000..02faeb6 --- /dev/null +++ b/lib/gllib/limits.in.h @@ -0,0 +1,63 @@ +/* A GNU-like <limits.h>. + + Copyright 2016-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. */ + +#ifndef _@GUARD_PREFIX@_LIMITS_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_LIMITS_H@ + +#ifndef _@GUARD_PREFIX@_LIMITS_H +#define _@GUARD_PREFIX@_LIMITS_H + +/* The number of usable bits in an unsigned or signed integer type + with minimum value MIN and maximum value MAX, as an int expression + suitable in #if. Cover all known practical hosts. This + implementation exploits the fact that MAX is 1 less than a power of + 2, and merely counts the number of 1 bits in MAX; "COBn" means + "count the number of 1 bits in the low-order n bits"). */ +#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max)) +#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n)) +#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n)) +#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n)) +#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n)) +#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n)) +#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1)) + +/* Macros specified by ISO/IEC TS 18661-1:2014. */ + +#if (! defined ULLONG_WIDTH \ + && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) +# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) +# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) +# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) +# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX) +# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX) +# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX) +# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX) +# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX) +# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) +# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) +# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) +#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ + +#endif /* _@GUARD_PREFIX@_LIMITS_H */ +#endif /* _@GUARD_PREFIX@_LIMITS_H */ diff --git a/lib/gllib/minmax.h b/lib/gllib/minmax.h index 5a763f8..c5344c4 100644 --- a/lib/gllib/minmax.h +++ b/lib/gllib/minmax.h @@ -1,5 +1,5 @@ /* MIN, MAX macros. - Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2014 Free Software + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/lib/gllib/stddef.in.h b/lib/gllib/stddef.in.h index ec944fd..c828192 100644 --- a/lib/gllib/stddef.in.h +++ b/lib/gllib/stddef.in.h @@ -1,6 +1,6 @@ /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -39,7 +39,6 @@ # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) # ifdef __need_wint_t -# undef _@GUARD_PREFIX@_STDDEF_H # define _GL_STDDEF_WINT_T # endif # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ @@ -54,33 +53,58 @@ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ -# ifndef _@GUARD_PREFIX@_STDDEF_H -# define _@GUARD_PREFIX@_STDDEF_H - /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ -#if @REPLACE_NULL@ -# undef NULL -# ifdef __cplusplus +# if (@REPLACE_NULL@ \ + && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T)) +# undef NULL +# ifdef __cplusplus /* ISO C++ says that the macro NULL must expand to an integer constant expression, hence '((void *) 0)' is not allowed in C++. */ -# if __GNUG__ >= 3 +# if __GNUG__ >= 3 /* GNU C++ has a __null macro that behaves like an integer ('int' or 'long') but has the same size as a pointer. Use that, to avoid warnings. */ -# define NULL __null -# else -# define NULL 0L +# define NULL __null +# else +# define NULL 0L +# endif +# else +# define NULL ((void *) 0) +# endif # endif -# else -# define NULL ((void *) 0) -# endif -#endif + +# ifndef _@GUARD_PREFIX@_STDDEF_H +# define _@GUARD_PREFIX@_STDDEF_H /* Some platforms lack wchar_t. */ #if !@HAVE_WCHAR_T@ # define wchar_t int #endif +/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is + a hack in case the configure-time test was done with g++ even though + we are currently compiling with gcc. */ +#if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T) +/* On the x86, the maximum storage alignment of double, long, etc. is 4, + but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, + and the C11 standard allows this. Work around this problem by + using __alignof__ (which returns 8 for double) rather than _Alignof + (which returns 4), and align each union member accordingly. */ +# ifdef __GNUC__ +# define _GL_STDDEF_ALIGNAS(type) \ + __attribute__ ((__aligned__ (__alignof__ (type)))) +# else +# define _GL_STDDEF_ALIGNAS(type) /* */ +# endif +typedef union +{ + char *__p _GL_STDDEF_ALIGNAS (char *); + double __d _GL_STDDEF_ALIGNAS (double); + long double __ld _GL_STDDEF_ALIGNAS (long double); + long int __i _GL_STDDEF_ALIGNAS (long int); +} max_align_t; +#endif + # endif /* _@GUARD_PREFIX@_STDDEF_H */ # endif /* _@GUARD_PREFIX@_STDDEF_H */ #endif /* __need_XXX */ diff --git a/lib/gllib/stdint.in.h b/lib/gllib/stdint.in.h index ef4cf91..1251a92 100644 --- a/lib/gllib/stdint.in.h +++ b/lib/gllib/stdint.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2014 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2017 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -79,54 +79,60 @@ #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H #define _@GUARD_PREFIX@_STDINT_H +/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, + LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ +#include <limits.h> + +/* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides + wint_t. */ +#if @GNULIB_OVERRIDES_WINT_T@ +# undef WINT_MIN +# undef WINT_MAX +# define WINT_MIN 0x0U +# define WINT_MAX 0xffffffffU +#endif + +#if ! @HAVE_C99_STDINT_H@ + /* <sys/types.h> defines some of the stdint.h types as well, on glibc, IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). AIX 5.2 <sys/types.h> isn't needed and causes troubles. Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but relies on the system <stdint.h> definitions, so include <sys/types.h> after @NEXT_STDINT_H@. */ -#if @HAVE_SYS_TYPES_H@ && ! defined _AIX -# include <sys/types.h> -#endif - -/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, - LONG_MIN, LONG_MAX, ULONG_MAX. */ -#include <limits.h> +# if @HAVE_SYS_TYPES_H@ && ! defined _AIX +# include <sys/types.h> +# endif -#if @HAVE_INTTYPES_H@ +# if @HAVE_INTTYPES_H@ /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. <inttypes.h> also defines intptr_t and uintptr_t. */ -# include <inttypes.h> -#elif @HAVE_SYS_INTTYPES_H@ +# include <inttypes.h> +# elif @HAVE_SYS_INTTYPES_H@ /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ -# include <sys/inttypes.h> -#endif +# include <sys/inttypes.h> +# endif -#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ +# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is included by <sys/types.h>. */ -# include <sys/bitypes.h> -#endif +# include <sys/bitypes.h> +# endif -#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H +# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* Minimum and maximum values for an integer type under the usual assumption. Return an unspecified value if BITS == 0, adding a check to pacify picky compilers. */ -#define _STDINT_MIN(signed, bits, zero) \ - ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) +# define _STDINT_MIN(signed, bits, zero) \ + ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) -#define _STDINT_MAX(signed, bits, zero) \ - ((signed) \ - ? ~ _STDINT_MIN (signed, bits, zero) \ - : /* The expression for the unsigned case. The subtraction of (signed) \ - is a nop in the unsigned case and avoids "signed integer overflow" \ - warnings in the signed case. */ \ - ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) +# define _STDINT_MAX(signed, bits, zero) \ + (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) #if !GNULIB_defined_stdint_types @@ -135,26 +141,26 @@ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. */ -#undef int8_t -#undef uint8_t +# undef int8_t +# undef uint8_t typedef signed char gl_int8_t; typedef unsigned char gl_uint8_t; -#define int8_t gl_int8_t -#define uint8_t gl_uint8_t +# define int8_t gl_int8_t +# define uint8_t gl_uint8_t -#undef int16_t -#undef uint16_t +# undef int16_t +# undef uint16_t typedef short int gl_int16_t; typedef unsigned short int gl_uint16_t; -#define int16_t gl_int16_t -#define uint16_t gl_uint16_t +# define int16_t gl_int16_t +# define uint16_t gl_uint16_t -#undef int32_t -#undef uint32_t +# undef int32_t +# undef uint32_t typedef int gl_int32_t; typedef unsigned int gl_uint32_t; -#define int32_t gl_int32_t -#define uint32_t gl_uint32_t +# define int32_t gl_int32_t +# define uint32_t gl_uint32_t /* If the system defines INT64_MAX, assume int64_t works. That way, if the underlying platform defines int64_t to be a 64-bit long long @@ -162,54 +168,54 @@ typedef unsigned int gl_uint32_t; int, which would mess up C++ name mangling. We must use #ifdef rather than #if, to avoid an error with HP-UX 10.20 cc. */ -#ifdef INT64_MAX -# define GL_INT64_T -#else +# ifdef INT64_MAX +# define GL_INT64_T +# else /* Do not undefine int64_t if gnulib is not being used with 64-bit types, since otherwise it breaks platforms like Tandem/NSK. */ -# if LONG_MAX >> 31 >> 31 == 1 -# undef int64_t +# if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t typedef long int gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -# elif defined _MSC_VER -# undef int64_t +# define int64_t gl_int64_t +# define GL_INT64_T +# elif defined _MSC_VER +# undef int64_t typedef __int64 gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -# elif @HAVE_LONG_LONG_INT@ -# undef int64_t +# define int64_t gl_int64_t +# define GL_INT64_T +# elif @HAVE_LONG_LONG_INT@ +# undef int64_t typedef long long int gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T +# define int64_t gl_int64_t +# define GL_INT64_T +# endif # endif -#endif -#ifdef UINT64_MAX -# define GL_UINT64_T -#else -# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -# undef uint64_t -typedef unsigned long int gl_uint64_t; -# define uint64_t gl_uint64_t +# ifdef UINT64_MAX # define GL_UINT64_T -# elif defined _MSC_VER -# undef uint64_t +# else +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t +typedef unsigned long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif defined _MSC_VER +# undef uint64_t typedef unsigned __int64 gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T -# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -# undef uint64_t +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# undef uint64_t typedef unsigned long long int gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# endif # endif -#endif /* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */ -#define _UINT8_T -#define _UINT32_T -#define _UINT64_T +# define _UINT8_T +# define _UINT32_T +# define _UINT64_T /* 7.18.1.2. Minimum-width integer types */ @@ -218,26 +224,26 @@ typedef unsigned long long int gl_uint64_t; types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types are the same as the corresponding N_t types. */ -#undef int_least8_t -#undef uint_least8_t -#undef int_least16_t -#undef uint_least16_t -#undef int_least32_t -#undef uint_least32_t -#undef int_least64_t -#undef uint_least64_t -#define int_least8_t int8_t -#define uint_least8_t uint8_t -#define int_least16_t int16_t -#define uint_least16_t uint16_t -#define int_least32_t int32_t -#define uint_least32_t uint32_t -#ifdef GL_INT64_T -# define int_least64_t int64_t -#endif -#ifdef GL_UINT64_T -# define uint_least64_t uint64_t -#endif +# undef int_least8_t +# undef uint_least8_t +# undef int_least16_t +# undef uint_least16_t +# undef int_least32_t +# undef uint_least32_t +# undef int_least64_t +# undef uint_least64_t +# define int_least8_t int8_t +# define uint_least8_t uint8_t +# define int_least16_t int16_t +# define uint_least16_t uint16_t +# define int_least32_t int32_t +# define uint_least32_t uint32_t +# ifdef GL_INT64_T +# define int_least64_t int64_t +# endif +# ifdef GL_UINT64_T +# define uint_least64_t uint64_t +# endif /* 7.18.1.3. Fastest minimum-width integer types */ @@ -250,50 +256,55 @@ typedef unsigned long long int gl_uint64_t; uses types consistent with glibc, as that lessens the chance of incompatibility with older GNU hosts. */ -#undef int_fast8_t -#undef uint_fast8_t -#undef int_fast16_t -#undef uint_fast16_t -#undef int_fast32_t -#undef uint_fast32_t -#undef int_fast64_t -#undef uint_fast64_t +# undef int_fast8_t +# undef uint_fast8_t +# undef int_fast16_t +# undef uint_fast16_t +# undef int_fast32_t +# undef uint_fast32_t +# undef int_fast64_t +# undef uint_fast64_t typedef signed char gl_int_fast8_t; typedef unsigned char gl_uint_fast8_t; -#ifdef __sun +# ifdef __sun /* Define types compatible with SunOS 5.10, so that code compiled under earlier SunOS versions works with code compiled under SunOS 5.10. */ typedef int gl_int_fast32_t; typedef unsigned int gl_uint_fast32_t; -#else +# else typedef long int gl_int_fast32_t; typedef unsigned long int gl_uint_fast32_t; -#endif +# endif typedef gl_int_fast32_t gl_int_fast16_t; typedef gl_uint_fast32_t gl_uint_fast16_t; -#define int_fast8_t gl_int_fast8_t -#define uint_fast8_t gl_uint_fast8_t -#define int_fast16_t gl_int_fast16_t -#define uint_fast16_t gl_uint_fast16_t -#define int_fast32_t gl_int_fast32_t -#define uint_fast32_t gl_uint_fast32_t -#ifdef GL_INT64_T -# define int_fast64_t int64_t -#endif -#ifdef GL_UINT64_T -# define uint_fast64_t uint64_t -#endif +# define int_fast8_t gl_int_fast8_t +# define uint_fast8_t gl_uint_fast8_t +# define int_fast16_t gl_int_fast16_t +# define uint_fast16_t gl_uint_fast16_t +# define int_fast32_t gl_int_fast32_t +# define uint_fast32_t gl_uint_fast32_t +# ifdef GL_INT64_T +# define int_fast64_t int64_t +# endif +# ifdef GL_UINT64_T +# define uint_fast64_t uint64_t +# endif /* 7.18.1.4. Integer types capable of holding object pointers */ -#undef intptr_t -#undef uintptr_t +/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own + definitions of intptr_t and uintptr_t (which use int and unsigned) + to avoid clashes with declarations of system functions like sbrk. */ +# ifndef _INTPTR_T_DECLARED +# undef intptr_t +# undef uintptr_t typedef long int gl_intptr_t; typedef unsigned long int gl_uintptr_t; -#define intptr_t gl_intptr_t -#define uintptr_t gl_uintptr_t +# define intptr_t gl_intptr_t +# define uintptr_t gl_uintptr_t +# endif /* 7.18.1.5. Greatest-width integer types */ @@ -304,33 +315,33 @@ typedef unsigned long int gl_uintptr_t; similarly for UINTMAX_MAX and uintmax_t. This avoids problems with assuming one type where another is used by the system. */ -#ifndef INTMAX_MAX -# undef INTMAX_C -# undef intmax_t -# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# ifndef INTMAX_MAX +# undef INTMAX_C +# undef intmax_t +# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 typedef long long int gl_intmax_t; -# define intmax_t gl_intmax_t -# elif defined GL_INT64_T -# define intmax_t int64_t -# else +# define intmax_t gl_intmax_t +# elif defined GL_INT64_T +# define intmax_t int64_t +# else typedef long int gl_intmax_t; -# define intmax_t gl_intmax_t +# define intmax_t gl_intmax_t +# endif # endif -#endif -#ifndef UINTMAX_MAX -# undef UINTMAX_C -# undef uintmax_t -# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# ifndef UINTMAX_MAX +# undef UINTMAX_C +# undef uintmax_t +# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 typedef unsigned long long int gl_uintmax_t; -# define uintmax_t gl_uintmax_t -# elif defined GL_UINT64_T -# define uintmax_t uint64_t -# else +# define uintmax_t gl_uintmax_t +# elif defined GL_UINT64_T +# define uintmax_t uint64_t +# else typedef unsigned long int gl_uintmax_t; -# define uintmax_t gl_uintmax_t +# define uintmax_t gl_uintmax_t +# endif # endif -#endif /* Verify that intmax_t and uintmax_t have the same size. Too much code breaks if this is not the case. If this check fails, the reason is likely @@ -338,8 +349,8 @@ typedef unsigned long int gl_uintmax_t; typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) ? 1 : -1]; -#define GNULIB_defined_stdint_types 1 -#endif /* !GNULIB_defined_stdint_types */ +# define GNULIB_defined_stdint_types 1 +# endif /* !GNULIB_defined_stdint_types */ /* 7.18.2. Limits of specified-width integer types */ @@ -348,37 +359,37 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. */ -#undef INT8_MIN -#undef INT8_MAX -#undef UINT8_MAX -#define INT8_MIN (~ INT8_MAX) -#define INT8_MAX 127 -#define UINT8_MAX 255 - -#undef INT16_MIN -#undef INT16_MAX -#undef UINT16_MAX -#define INT16_MIN (~ INT16_MAX) -#define INT16_MAX 32767 -#define UINT16_MAX 65535 - -#undef INT32_MIN -#undef INT32_MAX -#undef UINT32_MAX -#define INT32_MIN (~ INT32_MAX) -#define INT32_MAX 2147483647 -#define UINT32_MAX 4294967295U - -#if defined GL_INT64_T && ! defined INT64_MAX +# undef INT8_MIN +# undef INT8_MAX +# undef UINT8_MAX +# define INT8_MIN (~ INT8_MAX) +# define INT8_MAX 127 +# define UINT8_MAX 255 + +# undef INT16_MIN +# undef INT16_MAX +# undef UINT16_MAX +# define INT16_MIN (~ INT16_MAX) +# define INT16_MAX 32767 +# define UINT16_MAX 65535 + +# undef INT32_MIN +# undef INT32_MAX +# undef UINT32_MAX +# define INT32_MIN (~ INT32_MAX) +# define INT32_MAX 2147483647 +# define UINT32_MAX 4294967295U + +# if defined GL_INT64_T && ! defined INT64_MAX /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 evaluates the latter incorrectly in preprocessor expressions. */ -# define INT64_MIN (- INTMAX_C (1) << 63) -# define INT64_MAX INTMAX_C (9223372036854775807) -#endif +# define INT64_MIN (- INTMAX_C (1) << 63) +# define INT64_MAX INTMAX_C (9223372036854775807) +# endif -#if defined GL_UINT64_T && ! defined UINT64_MAX -# define UINT64_MAX UINTMAX_C (18446744073709551615) -#endif +# if defined GL_UINT64_T && ! defined UINT64_MAX +# define UINT64_MAX UINTMAX_C (18446744073709551615) +# endif /* 7.18.2.2. Limits of minimum-width integer types */ @@ -386,38 +397,38 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types are the same as the corresponding N_t types. */ -#undef INT_LEAST8_MIN -#undef INT_LEAST8_MAX -#undef UINT_LEAST8_MAX -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define UINT_LEAST8_MAX UINT8_MAX - -#undef INT_LEAST16_MIN -#undef INT_LEAST16_MAX -#undef UINT_LEAST16_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define UINT_LEAST16_MAX UINT16_MAX - -#undef INT_LEAST32_MIN -#undef INT_LEAST32_MAX -#undef UINT_LEAST32_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define UINT_LEAST32_MAX UINT32_MAX - -#undef INT_LEAST64_MIN -#undef INT_LEAST64_MAX -#ifdef GL_INT64_T -# define INT_LEAST64_MIN INT64_MIN -# define INT_LEAST64_MAX INT64_MAX -#endif +# undef INT_LEAST8_MIN +# undef INT_LEAST8_MAX +# undef UINT_LEAST8_MAX +# define INT_LEAST8_MIN INT8_MIN +# define INT_LEAST8_MAX INT8_MAX +# define UINT_LEAST8_MAX UINT8_MAX + +# undef INT_LEAST16_MIN +# undef INT_LEAST16_MAX +# undef UINT_LEAST16_MAX +# define INT_LEAST16_MIN INT16_MIN +# define INT_LEAST16_MAX INT16_MAX +# define UINT_LEAST16_MAX UINT16_MAX + +# undef INT_LEAST32_MIN +# undef INT_LEAST32_MAX +# undef UINT_LEAST32_MAX +# define INT_LEAST32_MIN INT32_MIN +# define INT_LEAST32_MAX INT32_MAX +# define UINT_LEAST32_MAX UINT32_MAX + +# undef INT_LEAST64_MIN +# undef INT_LEAST64_MAX +# ifdef GL_INT64_T +# define INT_LEAST64_MIN INT64_MIN +# define INT_LEAST64_MAX INT64_MAX +# endif -#undef UINT_LEAST64_MAX -#ifdef GL_UINT64_T -# define UINT_LEAST64_MAX UINT64_MAX -#endif +# undef UINT_LEAST64_MAX +# ifdef GL_UINT64_T +# define UINT_LEAST64_MAX UINT64_MAX +# endif /* 7.18.2.3. Limits of fastest minimum-width integer types */ @@ -425,117 +436,117 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types are taken from the same list of types. */ -#undef INT_FAST8_MIN -#undef INT_FAST8_MAX -#undef UINT_FAST8_MAX -#define INT_FAST8_MIN SCHAR_MIN -#define INT_FAST8_MAX SCHAR_MAX -#define UINT_FAST8_MAX UCHAR_MAX - -#undef INT_FAST16_MIN -#undef INT_FAST16_MAX -#undef UINT_FAST16_MAX -#define INT_FAST16_MIN INT_FAST32_MIN -#define INT_FAST16_MAX INT_FAST32_MAX -#define UINT_FAST16_MAX UINT_FAST32_MAX - -#undef INT_FAST32_MIN -#undef INT_FAST32_MAX -#undef UINT_FAST32_MAX -#ifdef __sun -# define INT_FAST32_MIN INT_MIN -# define INT_FAST32_MAX INT_MAX -# define UINT_FAST32_MAX UINT_MAX -#else -# define INT_FAST32_MIN LONG_MIN -# define INT_FAST32_MAX LONG_MAX -# define UINT_FAST32_MAX ULONG_MAX -#endif +# undef INT_FAST8_MIN +# undef INT_FAST8_MAX +# undef UINT_FAST8_MAX +# define INT_FAST8_MIN SCHAR_MIN +# define INT_FAST8_MAX SCHAR_MAX +# define UINT_FAST8_MAX UCHAR_MAX + +# undef INT_FAST16_MIN +# undef INT_FAST16_MAX +# undef UINT_FAST16_MAX +# define INT_FAST16_MIN INT_FAST32_MIN +# define INT_FAST16_MAX INT_FAST32_MAX +# define UINT_FAST16_MAX UINT_FAST32_MAX + +# undef INT_FAST32_MIN +# undef INT_FAST32_MAX +# undef UINT_FAST32_MAX +# ifdef __sun +# define INT_FAST32_MIN INT_MIN +# define INT_FAST32_MAX INT_MAX +# define UINT_FAST32_MAX UINT_MAX +# else +# define INT_FAST32_MIN LONG_MIN +# define INT_FAST32_MAX LONG_MAX +# define UINT_FAST32_MAX ULONG_MAX +# endif -#undef INT_FAST64_MIN -#undef INT_FAST64_MAX -#ifdef GL_INT64_T -# define INT_FAST64_MIN INT64_MIN -# define INT_FAST64_MAX INT64_MAX -#endif +# undef INT_FAST64_MIN +# undef INT_FAST64_MAX +# ifdef GL_INT64_T +# define INT_FAST64_MIN INT64_MIN +# define INT_FAST64_MAX INT64_MAX +# endif -#undef UINT_FAST64_MAX -#ifdef GL_UINT64_T -# define UINT_FAST64_MAX UINT64_MAX -#endif +# undef UINT_FAST64_MAX +# ifdef GL_UINT64_T +# define UINT_FAST64_MAX UINT64_MAX +# endif /* 7.18.2.4. Limits of integer types capable of holding object pointers */ -#undef INTPTR_MIN -#undef INTPTR_MAX -#undef UINTPTR_MAX -#define INTPTR_MIN LONG_MIN -#define INTPTR_MAX LONG_MAX -#define UINTPTR_MAX ULONG_MAX +# undef INTPTR_MIN +# undef INTPTR_MAX +# undef UINTPTR_MAX +# define INTPTR_MIN LONG_MIN +# define INTPTR_MAX LONG_MAX +# define UINTPTR_MAX ULONG_MAX /* 7.18.2.5. Limits of greatest-width integer types */ -#ifndef INTMAX_MAX -# undef INTMAX_MIN -# ifdef INT64_MAX -# define INTMAX_MIN INT64_MIN -# define INTMAX_MAX INT64_MAX -# else -# define INTMAX_MIN INT32_MIN -# define INTMAX_MAX INT32_MAX +# ifndef INTMAX_MAX +# undef INTMAX_MIN +# ifdef INT64_MAX +# define INTMAX_MIN INT64_MIN +# define INTMAX_MAX INT64_MAX +# else +# define INTMAX_MIN INT32_MIN +# define INTMAX_MAX INT32_MAX +# endif # endif -#endif -#ifndef UINTMAX_MAX -# ifdef UINT64_MAX -# define UINTMAX_MAX UINT64_MAX -# else -# define UINTMAX_MAX UINT32_MAX +# ifndef UINTMAX_MAX +# ifdef UINT64_MAX +# define UINTMAX_MAX UINT64_MAX +# else +# define UINTMAX_MAX UINT32_MAX +# endif # endif -#endif /* 7.18.3. Limits of other integer types */ /* ptrdiff_t limits */ -#undef PTRDIFF_MIN -#undef PTRDIFF_MAX -#if @APPLE_UNIVERSAL_BUILD@ -# ifdef _LP64 -# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) -# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) +# undef PTRDIFF_MIN +# undef PTRDIFF_MAX +# if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) +# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) +# else +# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) +# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) +# endif # else -# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) -# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) -# endif -#else -# define PTRDIFF_MIN \ +# define PTRDIFF_MIN \ _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) -# define PTRDIFF_MAX \ +# define PTRDIFF_MAX \ _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) -#endif +# endif /* sig_atomic_t limits */ -#undef SIG_ATOMIC_MIN -#undef SIG_ATOMIC_MAX -#define SIG_ATOMIC_MIN \ +# undef SIG_ATOMIC_MIN +# undef SIG_ATOMIC_MAX +# define SIG_ATOMIC_MIN \ _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ 0@SIG_ATOMIC_T_SUFFIX@) -#define SIG_ATOMIC_MAX \ +# define SIG_ATOMIC_MAX \ _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ 0@SIG_ATOMIC_T_SUFFIX@) /* size_t limit */ -#undef SIZE_MAX -#if @APPLE_UNIVERSAL_BUILD@ -# ifdef _LP64 -# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) +# undef SIZE_MAX +# if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) +# else +# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) +# endif # else -# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) +# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) # endif -#else -# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) -#endif /* wchar_t limits */ /* Get WCHAR_MIN, WCHAR_MAX. @@ -543,29 +554,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) sequence of nested includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes <stdint.h> and assumes its types are already defined. */ -#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) +# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included before <wchar.h>. */ -# include <stddef.h> -# include <stdio.h> -# include <time.h> -# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -# include <wchar.h> -# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -#endif -#undef WCHAR_MIN -#undef WCHAR_MAX -#define WCHAR_MIN \ +# include <stddef.h> +# include <stdio.h> +# include <time.h> +# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +# include <wchar.h> +# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +# endif +# undef WCHAR_MIN +# undef WCHAR_MAX +# define WCHAR_MIN \ _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) -#define WCHAR_MAX \ +# define WCHAR_MAX \ _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) /* wint_t limits */ -#undef WINT_MIN -#undef WINT_MAX -#define WINT_MIN \ +# undef WINT_MIN +# undef WINT_MAX +# define WINT_MIN \ _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) -#define WINT_MAX \ +# define WINT_MAX \ _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) /* 7.18.4. Macros for integer constants */ @@ -576,59 +587,120 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ -#undef INT8_C -#undef UINT8_C -#define INT8_C(x) x -#define UINT8_C(x) x - -#undef INT16_C -#undef UINT16_C -#define INT16_C(x) x -#define UINT16_C(x) x - -#undef INT32_C -#undef UINT32_C -#define INT32_C(x) x -#define UINT32_C(x) x ## U - -#undef INT64_C -#undef UINT64_C -#if LONG_MAX >> 31 >> 31 == 1 -# define INT64_C(x) x##L -#elif defined _MSC_VER -# define INT64_C(x) x##i64 -#elif @HAVE_LONG_LONG_INT@ -# define INT64_C(x) x##LL -#endif -#if ULONG_MAX >> 31 >> 31 >> 1 == 1 -# define UINT64_C(x) x##UL -#elif defined _MSC_VER -# define UINT64_C(x) x##ui64 -#elif @HAVE_UNSIGNED_LONG_LONG_INT@ -# define UINT64_C(x) x##ULL -#endif +# undef INT8_C +# undef UINT8_C +# define INT8_C(x) x +# define UINT8_C(x) x + +# undef INT16_C +# undef UINT16_C +# define INT16_C(x) x +# define UINT16_C(x) x + +# undef INT32_C +# undef UINT32_C +# define INT32_C(x) x +# define UINT32_C(x) x ## U + +# undef INT64_C +# undef UINT64_C +# if LONG_MAX >> 31 >> 31 == 1 +# define INT64_C(x) x##L +# elif defined _MSC_VER +# define INT64_C(x) x##i64 +# elif @HAVE_LONG_LONG_INT@ +# define INT64_C(x) x##LL +# endif +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# define UINT64_C(x) x##UL +# elif defined _MSC_VER +# define UINT64_C(x) x##ui64 +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# define UINT64_C(x) x##ULL +# endif /* 7.18.4.2. Macros for greatest-width integer constants */ -#ifndef INTMAX_C -# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define INTMAX_C(x) x##LL -# elif defined GL_INT64_T -# define INTMAX_C(x) INT64_C(x) -# else -# define INTMAX_C(x) x##L +# ifndef INTMAX_C +# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define INTMAX_C(x) x##LL +# elif defined GL_INT64_T +# define INTMAX_C(x) INT64_C(x) +# else +# define INTMAX_C(x) x##L +# endif # endif -#endif -#ifndef UINTMAX_C -# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -# define UINTMAX_C(x) x##ULL -# elif defined GL_UINT64_T -# define UINTMAX_C(x) UINT64_C(x) -# else -# define UINTMAX_C(x) x##UL +# ifndef UINTMAX_C +# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define UINTMAX_C(x) x##ULL +# elif defined GL_UINT64_T +# define UINTMAX_C(x) UINT64_C(x) +# else +# define UINTMAX_C(x) x##UL +# endif # endif -#endif + +#endif /* !@HAVE_C99_STDINT_H@ */ + +/* Macros specified by ISO/IEC TS 18661-1:2014. */ + +#if (!defined UINTMAX_WIDTH \ + && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) +# ifdef INT8_MAX +# define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX) +# endif +# ifdef UINT8_MAX +# define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX) +# endif +# ifdef INT16_MAX +# define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX) +# endif +# ifdef UINT16_MAX +# define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX) +# endif +# ifdef INT32_MAX +# define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX) +# endif +# ifdef UINT32_MAX +# define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX) +# endif +# ifdef INT64_MAX +# define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX) +# endif +# ifdef UINT64_MAX +# define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX) +# endif +# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX) +# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX) +# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX) +# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX) +# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX) +# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX) +# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX) +# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX) +# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX) +# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX) +# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX) +# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX) +# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX) +# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX) +# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX) +# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX) +# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX) +# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX) +# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX) +# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX) +# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX) +# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX) +# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX) +# ifdef WINT_MAX +# define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX) +# endif +# ifdef SIG_ATOMIC_MAX +# define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX) +# endif +#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ #endif /* _@GUARD_PREFIX@_STDINT_H */ #endif /* !(defined __ANDROID__ && ...) */ diff --git a/lib/gllib/string.in.h b/lib/gllib/string.in.h index 1d063ba..259ccdf 100644 --- a/lib/gllib/string.in.h +++ b/lib/gllib/string.in.h @@ -1,6 +1,6 @@ /* A GNU-like <string.h>. - Copyright (C) 1995-1996, 2001-2014 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -15,16 +15,32 @@ You should have received a copy of the GNU Lesser General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef _@GUARD_PREFIX@_STRING_H - #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ +#if defined _GL_ALREADY_INCLUDING_STRING_H +/* Special invocation convention: + - On OS X/NetBSD we have a sequence of nested includes + <string.h> -> <strings.h> -> "string.h" + In this situation system _chk variants due to -D_FORTIFY_SOURCE + might be used after any replacements defined here. */ + +#@INCLUDE_NEXT@ @NEXT_STRING_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_STRING_H + +#define _GL_ALREADY_INCLUDING_STRING_H + /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STRING_H@ +#undef _GL_ALREADY_INCLUDING_STRING_H + #ifndef _@GUARD_PREFIX@_STRING_H #define _@GUARD_PREFIX@_STRING_H @@ -400,15 +416,15 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - " # undef strndup # define strndup rpl_strndup # endif -_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n) +_GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n)); +_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); # else # if ! @HAVE_DECL_STRNDUP@ -_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n) +_GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n) _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n)); +_GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); # endif _GL_CXXALIASWARN (strndup); #elif defined GNULIB_POSIXCHECK @@ -428,17 +444,17 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - " # undef strnlen # define strnlen rpl_strnlen # endif -_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen) +_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)); +_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); # else # if ! @HAVE_DECL_STRNLEN@ -_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen) +_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)); +_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)); # endif _GL_CXXALIASWARN (strnlen); #elif defined GNULIB_POSIXCHECK @@ -1027,3 +1043,4 @@ _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " #endif /* _@GUARD_PREFIX@_STRING_H */ #endif /* _@GUARD_PREFIX@_STRING_H */ +#endif diff --git a/lib/gllib/strverscmp.c b/lib/gllib/strverscmp.c index 0abc1fe..0d8ac1c 100644 --- a/lib/gllib/strverscmp.c +++ b/lib/gllib/strverscmp.c @@ -1,21 +1,21 @@ /* Compare strings while treating digits characters numerically. - Copyright (C) 1997, 2000, 2002, 2004, 2006, 2009-2014 Free Software - Foundation, Inc. + Copyright (C) 1997-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, or (at your option) - any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #if !_LIBC # include <config.h> @@ -26,27 +26,14 @@ /* states: S_N: normal, S_I: comparing integral part, S_F: comparing fractional parts, S_Z: idem but with leading Zeroes only */ -#define S_N 0x0 -#define S_I 0x4 -#define S_F 0x8 -#define S_Z 0xC +#define S_N 0x0 +#define S_I 0x3 +#define S_F 0x6 +#define S_Z 0x9 /* result_type: CMP: return diff; LEN: compare using len_diff/diff */ -#define CMP 2 -#define LEN 3 - - -/* ISDIGIT differs from isdigit, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char - or EOF. - - It's typically faster. - POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to - isdigit unless it's important to use the locale's definition - of "digit" even when the host does not conform to POSIX. */ -#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) - -#undef __strverscmp -#undef strverscmp +#define CMP 2 +#define LEN 3 #ifndef weak_alias # define __strverscmp strverscmp @@ -66,30 +53,25 @@ __strverscmp (const char *s1, const char *s2) int state; int diff; - /* Symbol(s) 0 [1-9] others (padding) - Transition (10) 0 (01) d (00) x (11) - */ - static const unsigned int next_state[] = + /* Symbol(s) 0 [1-9] others + Transition (10) 0 (01) d (00) x */ + static const unsigned char next_state[] = { - /* state x d 0 - */ - /* S_N */ S_N, S_I, S_Z, S_N, - /* S_I */ S_N, S_I, S_I, S_I, - /* S_F */ S_N, S_F, S_F, S_F, - /* S_Z */ S_N, S_F, S_Z, S_Z + /* state x d 0 */ + /* S_N */ S_N, S_I, S_Z, + /* S_I */ S_N, S_I, S_I, + /* S_F */ S_N, S_F, S_F, + /* S_Z */ S_N, S_F, S_Z }; - static const int result_type[] = + static const signed char result_type[] = { - /* state x/x x/d x/0 x/- d/x d/d d/0 d/- - 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */ - - /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, - CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, - /* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP, - 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP, - /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP, - CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, - /* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP, - -1, CMP, CMP, CMP + /* state x/x x/d x/0 d/x d/d d/0 0/x 0/d 0/0 */ + + /* S_N */ CMP, CMP, CMP, CMP, LEN, CMP, CMP, CMP, CMP, + /* S_I */ CMP, -1, -1, +1, LEN, LEN, +1, LEN, LEN, + /* S_F */ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, + /* S_Z */ CMP, +1, +1, -1, CMP, CMP, -1, CMP, CMP }; if (p1 == p2) @@ -98,17 +80,20 @@ __strverscmp (const char *s1, const char *s2) c1 = *p1++; c2 = *p2++; /* Hint: '0' is a digit too. */ - state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0)); + state = S_N + ((c1 == '0') + (isdigit (c1) != 0)); - while ((diff = c1 - c2) == 0 && c1 != '\0') + while ((diff = c1 - c2) == 0) { + if (c1 == '\0') + return diff; + state = next_state[state]; c1 = *p1++; c2 = *p2++; - state |= (c1 == '0') + (ISDIGIT (c1) != 0); + state += (c1 == '0') + (isdigit (c1) != 0); } - state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))]; + state = result_type[state * 3 + (((c2 == '0') + (isdigit (c2) != 0)))]; switch (state) { @@ -116,16 +101,17 @@ __strverscmp (const char *s1, const char *s2) return diff; case LEN: - while (ISDIGIT (*p1++)) - if (!ISDIGIT (*p2++)) + while (isdigit (*p1++)) + if (!isdigit (*p2++)) return 1; - return ISDIGIT (*p2) ? -1 : diff; + return isdigit (*p2) ? -1 : diff; default: return state; } } #ifdef weak_alias +libc_hidden_def (__strverscmp) weak_alias (__strverscmp, strverscmp) #endif diff --git a/lib/gllib/sys_types.in.h b/lib/gllib/sys_types.in.h index 40c8d57..abdd7f0 100644 --- a/lib/gllib/sys_types.in.h +++ b/lib/gllib/sys_types.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/types.h. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/lib/gllib/verify.h b/lib/gllib/verify.h new file mode 100644 index 0000000..a9ef798 --- /dev/null +++ b/lib/gllib/verify.h @@ -0,0 +1,279 @@ +/* Compile-time assert-like macros. + + Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ + +#ifndef _GL_VERIFY_H +#define _GL_VERIFY_H + + +/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per C11. + This is supported by GCC 4.6.0 and later, in C mode, and its use + here generates easier-to-read diagnostics when verify (R) fails. + + Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11. + This will likely be supported by future GCC versions, in C++ mode. + + Use this only with GCC. If we were willing to slow 'configure' + down we could also use it with other compilers, but since this + affects only the quality of diagnostics, why bother? */ +#if (4 < __GNUC__ + (6 <= __GNUC_MINOR__) \ + && (201112L <= __STDC_VERSION__ || !defined __STRICT_ANSI__) \ + && !defined __cplusplus) +# define _GL_HAVE__STATIC_ASSERT 1 +#endif +/* The condition (99 < __GNUC__) is temporary, until we know about the + first G++ release that supports static_assert. */ +#if (99 < __GNUC__) && defined __cplusplus +# define _GL_HAVE_STATIC_ASSERT 1 +#endif + +/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other + system headers, defines a conflicting _Static_assert that is no + better than ours; override it. */ +#ifndef _GL_HAVE_STATIC_ASSERT +# include <stddef.h> +# undef _Static_assert +#endif + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + If _Static_assert works, verify (R) uses it directly. Similarly, + _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct + that is an operand of sizeof. + + The code below uses several ideas for C++ compilers, and for C + compilers that do not support _Static_assert: + + * The first step is ((R) ? 1 : -1). Given an expression R, of + integral or boolean or floating-point type, this yields an + expression of integral type, whose value is later verified to be + constant and nonnegative. + + * Next this expression W is wrapped in a type + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: W; + }. + If W is negative, this yields a compile-time error. No compiler can + deal with a bit-field of negative size. + + One might think that an array size check would have the same + effect, that is, that the type struct { unsigned int dummy[W]; } + would work as well. However, inside a function, some compilers + (such as C++ compilers and GNU C) allow local parameters and + variables inside array size expressions. With these compilers, + an array size check would not properly diagnose this misuse of + the verify macro: + + void function (int n) { verify (n < 0); } + + * For the verify macro, the struct _gl_verify_type will need to + somehow be embedded into a declaration. To be portable, this + declaration must declare an object, a constant, a function, or a + typedef name. If the declared entity uses the type directly, + such as in + + struct dummy {...}; + typedef struct {...} dummy; + extern struct {...} *dummy; + extern void dummy (struct {...} *); + extern struct {...} *dummy (void); + + two uses of the verify macro would yield colliding declarations + if the entity names are not disambiguated. A workaround is to + attach the current line number to the entity name: + + #define _GL_CONCAT0(x, y) x##y + #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) + extern struct {...} * _GL_CONCAT (dummy, __LINE__); + + But this has the problem that two invocations of verify from + within the same macro would collide, since the __LINE__ value + would be the same for both invocations. (The GCC __COUNTER__ + macro solves this problem, but is not portable.) + + A solution is to use the sizeof operator. It yields a number, + getting rid of the identity of the type. Declarations like + + extern int dummy [sizeof (struct {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + + can be repeated. + + * Should the implementation use a named struct or an unnamed struct? + Which of the following alternatives can be used? + + extern int dummy [sizeof (struct {...})]; + extern int dummy [sizeof (struct _gl_verify_type {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern void dummy (int [sizeof (struct _gl_verify_type {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})]; + + In the second and sixth case, the struct type is exported to the + outer scope; two such declarations therefore collide. GCC warns + about the first, third, and fourth cases. So the only remaining + possibility is the fifth case: + + extern int (*dummy (void)) [sizeof (struct {...})]; + + * GCC warns about duplicate declarations of the dummy function if + -Wredundant-decls is used. GCC 4.3 and later have a builtin + __COUNTER__ macro that can let us generate unique identifiers for + each dummy function, to suppress this warning. + + * This implementation exploits the fact that older versions of GCC, + which do not support _Static_assert, also do not warn about the + last declaration mentioned above. + + * GCC warns if -Wnested-externs is enabled and verify() is used + within a function body; but inside a function, you can always + arrange to use verify_expr() instead. + + * In C++, any struct definition inside sizeof is invalid. + Use a template type to work around the problem. */ + +/* Concatenate two preprocessor tokens. */ +#define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) +#define _GL_CONCAT0(x, y) x##y + +/* _GL_COUNTER is an integer, preferably one that changes each time we + use it. Use __COUNTER__ if it works, falling back on __LINE__ + otherwise. __LINE__ isn't perfect, but it's better than a + constant. */ +#if defined __COUNTER__ && __COUNTER__ != __COUNTER__ +# define _GL_COUNTER __COUNTER__ +#else +# define _GL_COUNTER __LINE__ +#endif + +/* Generate a symbol with the given prefix, making it unique if + possible. */ +#define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) + +/* Verify requirement R at compile-time, as an integer constant expression + that returns 1. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. */ + +#define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ + (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC))) + +#ifdef __cplusplus +# if !GNULIB_defined_struct__gl_verify_type +template <int w> + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: w; + }; +# define GNULIB_defined_struct__gl_verify_type 1 +# endif +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + _gl_verify_type<(R) ? 1 : -1> +#elif defined _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { \ + _Static_assert (R, DIAGNOSTIC); \ + int _gl_dummy; \ + } +#else +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } +#endif + +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. + + Unfortunately, unlike C11, this implementation must appear as an + ordinary declaration, and cannot appear inside struct { ... }. */ + +#ifdef _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY _Static_assert +#else +# define _GL_VERIFY(R, DIAGNOSTIC) \ + extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ + [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] +#endif + +/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ +#ifdef _GL_STATIC_ASSERT_H +# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert +# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC) +# endif +# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert +# define static_assert _Static_assert /* C11 requires this #define. */ +# endif +#endif + +/* @assert.h omit start@ */ + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + There are two macros, since no single macro can be used in all + contexts in C. verify_true (R) is for scalar contexts, including + integer constant expression contexts. verify (R) is for declaration + contexts, e.g., the top level. */ + +/* Verify requirement R at compile-time, as an integer constant expression. + Return 1. This is equivalent to verify_expr (R, 1). + + verify_true is obsolescent; please use verify_expr instead. */ + +#define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")") + +/* Verify requirement R at compile-time. Return the value of the + expression E. */ + +#define verify_expr(R, E) \ + (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E)) + +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. */ + +#define verify(R) _GL_VERIFY (R, "verify (" #R ")") + +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + +/* Assume that R always holds. This lets the compiler optimize + accordingly. R should not have side-effects; it may or may not be + evaluated. Behavior is undefined if R is false. */ + +#if (__has_builtin (__builtin_unreachable) \ + || 4 < __GNUC__ + (5 <= __GNUC_MINOR__)) +# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) +#elif 1200 <= _MSC_VER +# define assume(R) __assume (R) +#elif ((defined GCC_LINT || defined lint) \ + && (__has_builtin (__builtin_trap) \ + || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)))) + /* Doing it this way helps various packages when configured with + --enable-gcc-warnings, which compiles with -Dlint. It's nicer + when 'assume' silences warnings even with older GCCs. */ +# define assume(R) ((R) ? (void) 0 : __builtin_trap ()) +#else +# define assume(R) ((void) (0 && (R))) +#endif + +/* @assert.h omit end@ */ + +#endif diff --git a/lib/glm4/gnulib-comp.m4 b/lib/glm4/gnulib-comp.m4 index 3af169f..38f4c34 100644 --- a/lib/glm4/gnulib-comp.m4 +++ b/lib/glm4/gnulib-comp.m4 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2017 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -37,16 +37,20 @@ AC_DEFUN([lgl_EARLY], m4_pattern_allow([^gl_ES$])dnl a valid locale name m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable + + # Pre-early section. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_PROG_AR_RANLIB]) + # Code from module absolute-header: # Code from module extensions: - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) # Code from module extern-inline: # Code from module hash-pjw-bare: # Code from module include_next: # Code from module intprops: # Code from module lib-symbol-versions: # Code from module lib-symbol-visibility: + # Code from module limits-h: # Code from module minmax: # Code from module multiarch: # Code from module snippet/arg-nonnull: @@ -58,6 +62,7 @@ AC_DEFUN([lgl_EARLY], # Code from module string: # Code from module strverscmp: # Code from module sys_types: + # Code from module verify: ]) # This macro should be invoked from ./configure.ac, in the section @@ -77,6 +82,7 @@ AC_DEFUN([lgl_INIT], AC_REQUIRE([gl_EXTERN_INLINE]) gl_LD_VERSION_SCRIPT gl_VISIBILITY + gl_LIMITS_H gl_MINMAX gl_MULTIARCH gt_TYPE_SSIZE_T @@ -233,12 +239,14 @@ AC_DEFUN([lgl_FILE_LIST], [ lib/hash-pjw-bare.c lib/hash-pjw-bare.h lib/intprops.h + lib/limits.in.h lib/minmax.h lib/stddef.in.h lib/stdint.in.h lib/string.in.h lib/strverscmp.c lib/sys_types.in.h + lib/verify.h m4/00gnulib.m4 m4/absolute-header.m4 m4/extensions.m4 @@ -246,6 +254,7 @@ AC_DEFUN([lgl_FILE_LIST], [ m4/gnulib-common.m4 m4/include_next.m4 m4/ld-version-script.m4 + m4/limits-h.m4 m4/longlong.m4 m4/minmax.m4 m4/multiarch.m4 @@ -259,4 +268,5 @@ AC_DEFUN([lgl_FILE_LIST], [ m4/visibility.m4 m4/warn-on-use.m4 m4/wchar_t.m4 + m4/wint_t.m4 ]) diff --git a/lib/glm4/ld-version-script.m4 b/lib/glm4/ld-version-script.m4 index f8b4a5c..caccec1 100644 --- a/lib/glm4/ld-version-script.m4 +++ b/lib/glm4/ld-version-script.m4 @@ -1,5 +1,5 @@ -# ld-version-script.m4 serial 3 -dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. +# ld-version-script.m4 serial 4 +dnl Copyright (C) 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -18,20 +18,18 @@ dnl From Simon Josefsson AC_DEFUN([gl_LD_VERSION_SCRIPT], [ AC_ARG_ENABLE([ld-version-script], - AS_HELP_STRING([--enable-ld-version-script], - [enable linker version script (default is enabled when possible)]), - [have_ld_version_script=$enableval], []) - if test -z "$have_ld_version_script"; then - AC_MSG_CHECKING([if LD -Wl,--version-script works]) - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" - cat > conftest.map <<EOF -foo -EOF - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [accepts_syntax_errors=yes], [accepts_syntax_errors=no]) - if test "$accepts_syntax_errors" = no; then - cat > conftest.map <<EOF + [AS_HELP_STRING([--enable-ld-version-script], + [enable linker version script (default is enabled when possible)])], + [have_ld_version_script=$enableval], + [AC_CACHE_CHECK([if LD -Wl,--version-script works], + [gl_cv_sys_ld_version_script], + [gl_cv_sys_ld_version_script=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + echo foo >conftest.map + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [], + [cat > conftest.map <<EOF VERS_1 { global: sym; }; @@ -40,14 +38,11 @@ VERS_2 { global: sym; } VERS_1; EOF - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [have_ld_version_script=yes], [have_ld_version_script=no]) - else - have_ld_version_script=no - fi - rm -f conftest.map - LDFLAGS="$save_LDFLAGS" - AC_MSG_RESULT($have_ld_version_script) - fi - AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [gl_cv_sys_ld_version_script=yes])]) + rm -f conftest.map + LDFLAGS=$save_LDFLAGS]) + have_ld_version_script=$gl_cv_sys_ld_version_script]) + AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT], + [test "$have_ld_version_script" = yes]) ]) diff --git a/lib/glm4/minmax.m4 b/lib/glm4/minmax.m4 index edbeb43..6845fce 100644 --- a/lib/glm4/minmax.m4 +++ b/lib/glm4/minmax.m4 @@ -1,5 +1,5 @@ # minmax.m4 serial 4 -dnl Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/lib/glm4/string_h.m4 b/lib/glm4/string_h.m4 index 64e683f..3d2ad22 100644 --- a/lib/glm4/string_h.m4 +++ b/lib/glm4/string_h.m4 @@ -1,6 +1,6 @@ # Configure a GNU-like replacement for <string.h>. -# Copyright (C) 2007-2014 Free Software Foundation, Inc. +# Copyright (C) 2007-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/lib/glm4/strverscmp.m4 b/lib/glm4/strverscmp.m4 index aca1d54..cbcca3f 100644 --- a/lib/glm4/strverscmp.m4 +++ b/lib/glm4/strverscmp.m4 @@ -1,5 +1,5 @@ # strverscmp.m4 serial 8 -dnl Copyright (C) 2002, 2005-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/lib/glm4/visibility.m4 b/lib/glm4/visibility.m4 index 552e397..ce00e72 100644 --- a/lib/glm4/visibility.m4 +++ b/lib/glm4/visibility.m4 @@ -1,5 +1,5 @@ # visibility.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2005, 2008, 2010-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2008, 2010-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/lib/libtasn1.h b/lib/libtasn1.h index 5c4340f..4ad01e7 100644 --- a/lib/libtasn1.h +++ b/lib/libtasn1.h @@ -44,7 +44,7 @@ extern "C" { #endif -#define ASN1_VERSION "4.9" +#define ASN1_VERSION "4.10" #if defined(__GNUC__) && !defined(ASN1_INTERNAL_BUILD) # define _ASN1_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) @@ -377,7 +377,7 @@ extern "C" extern ASN1_API int asn1_get_object_id_der (const unsigned char *der, int der_len, int *ret_len, - char *str, int str_size); + char *str, int str_size); /* Compatibility types */ diff --git a/lib/parser_aux.c b/lib/parser_aux.c index 2285b20..b4a7370 100644 --- a/lib/parser_aux.c +++ b/lib/parser_aux.c @@ -84,7 +84,7 @@ _asn1_add_static_node (unsigned int type) * @name: null terminated string with the element's name to find. * * Searches for an element called @name starting from @pointer. The - * name is composed by differents identifiers separated by dots. When + * name is composed by different identifiers separated by dots. When * *@pointer has a name, the first identifier must be the name of * *@pointer, otherwise it must be the name of one child of *@pointer. * @@ -551,29 +551,33 @@ _asn1_delete_list_and_nodes (void) char * _asn1_ltostr (int64_t v, char str[LTOSTR_MAX_SIZE]) { - int64_t d, r; + uint64_t d, r; char temp[LTOSTR_MAX_SIZE]; int count, k, start; + uint64_t val; if (v < 0) { str[0] = '-'; start = 1; - v = -v; + val = -((uint64_t)v); } else - start = 0; + { + val = v; + start = 0; + } count = 0; do { - d = v / 10; - r = v - d * 10; + d = val / 10; + r = val - d * 10; temp[start + count] = '0' + (char) r; count++; - v = d; + val = d; } - while (v && ((start+count) < LTOSTR_MAX_SIZE-1)); + while (val && ((start+count) < LTOSTR_MAX_SIZE-1)); for (k = 0; k < count; k++) str[k + start] = temp[start + count - k - 1]; @@ -637,7 +641,7 @@ _asn1_change_integer_value (asn1_node node) p = NULL; break; } - if (p->right) + if (p && p->right) { p = p->right; break; @@ -753,7 +757,7 @@ _asn1_expand_object_id (asn1_node node) if (move == RIGHT) { - if (p->right) + if (p && p->right) p = p->right; else move = UP; @@ -828,7 +832,7 @@ _asn1_expand_object_id (asn1_node node) if (move == RIGHT) { - if (p->right) + if (p && p->right) p = p->right; else move = UP; @@ -898,7 +902,7 @@ _asn1_type_set_config (asn1_node node) if (move == RIGHT) { - if (p->right) + if (p && p->right) p = p->right; else move = UP; @@ -1007,7 +1011,7 @@ _asn1_check_identifier (asn1_node node) p = NULL; break; } - if (p->right) + if (p && p->right) { p = p->right; break; @@ -1067,7 +1071,7 @@ _asn1_set_default_tag (asn1_node node) p = NULL; break; } - if (p->right) + if (p && p->right) { p = p->right; break; |