From 0bc8d16b21f5985012d32bffa5e36059aff6c9a7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 7 Aug 2014 17:40:01 -0700 Subject: [PATCH] vla: new module * MODULES.html.sh: Add vla. * lib/vla.h, modules/vla: New files. --- ChangeLog | 4 ++++ MODULES.html.sh | 1 + lib/vla.h | 27 +++++++++++++++++++++++++++ modules/vla | 20 ++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 lib/vla.h create mode 100644 modules/vla diff --git a/ChangeLog b/ChangeLog index 386520b..a610b5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2014-08-07 Paul Eggert + vla: new module + * MODULES.html.sh: Add vla. + * lib/vla.h, modules/vla: New files. + vararrays: modernize AC_C_VARARRAYS for C11 This backports a change I recently made to Autoconf. * m4/vararrays.m4 (AC_C_VARARRAYS): Define __STDC_NO_VLA__ if diff --git a/MODULES.html.sh b/MODULES.html.sh index 2163f94..6c4520a 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2043,6 +2043,7 @@ func_all_modules () func_module snippet/unused-parameter func_module va-args func_module vararrays + func_module vla func_end_table element="Sizes of integer types " diff --git a/lib/vla.h b/lib/vla.h new file mode 100644 index 0000000..05125a7 --- /dev/null +++ b/lib/vla.h @@ -0,0 +1,27 @@ +/* vla.h - variable length arrays + + Copyright 2014 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 + the Free Software Foundation; either version 3 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Written by Paul Eggert. */ + +/* A function's argument must point to an array with at least N elements. + Example: 'int main (int argc, char *argv[VLA_ELEMS (argc)]);'. */ + +#ifdef __STDC_NO_VLA__ +# define VLA_ELEMS(n) +#else +# define VLA_ELEMS(n) static n +#endif diff --git a/modules/vla b/modules/vla new file mode 100644 index 0000000..a007f88 --- /dev/null +++ b/modules/vla @@ -0,0 +1,20 @@ +Description: +Macros for dealing with variable length arrays. + +Files: +lib/vla.h + +Depends-on: +vararrays + +configure.ac: + +Makefile.am: + +Include: + +License: +GPL + +Maintainer: +all -- 1.9.3