aboutsummaryrefslogtreecommitdiff
path: root/libiberty/regex.c
AgeCommit message (Collapse)AuthorFilesLines
2022-01-15Add -Wuse-after-free [PR80532].Martin Sebor1-0/+4
gcc/c-family/ChangeLog PR tree-optimization/80532 * c.opt (-Wuse-after-free): New options. gcc/ChangeLog: PR tree-optimization/80532 * common.opt (-Wuse-after-free): New options. * diagnostic-spec.c (nowarn_spec_t::nowarn_spec_t): Handle OPT_Wreturn_local_addr and OPT_Wuse_after_free_. * diagnostic-spec.h (NW_DANGLING): New enumerator. * doc/invoke.texi (-Wuse-after-free): Document new option. * gimple-ssa-warn-access.cc (pass_waccess::check_call): Rename... (pass_waccess::check_call_access): ...to this. (pass_waccess::check): Rename... (pass_waccess::check_block): ...to this. (pass_waccess::check_pointer_uses): New function. (pass_waccess::gimple_call_return_arg): New function. (pass_waccess::warn_invalid_pointer): New function. (pass_waccess::check_builtin): Handle free and realloc. (gimple_use_after_inval_p): New function. (get_realloc_lhs): New function. (maybe_warn_mismatched_realloc): New function. (pointers_related_p): New function. (pass_waccess::check_call): Call check_pointer_uses. (pass_waccess::execute): Compute and free dominance info. libcpp/ChangeLog: * files.c (_cpp_find_file): Substitute a valid pointer for an invalid one to avoid -Wuse-after-free. libiberty/ChangeLog: * regex.c: Suppress -Wuse-after-free. gcc/testsuite/ChangeLog: PR tree-optimization/80532 * gcc.dg/Wmismatched-dealloc-2.c: Avoid -Wuse-after-free. * gcc.dg/Wmismatched-dealloc-3.c: Same. * gcc.dg/analyzer/file-1.c: Prune expected warning. * gcc.dg/analyzer/file-2.c: Same. * gcc.dg/attr-alloc_size-6.c: Disable -Wuse-after-free. * gcc.dg/attr-alloc_size-7.c: Same. * c-c++-common/Wuse-after-free-2.c: New test. * c-c++-common/Wuse-after-free-3.c: New test. * c-c++-common/Wuse-after-free-4.c: New test. * c-c++-common/Wuse-after-free-5.c: New test. * c-c++-common/Wuse-after-free-6.c: New test. * c-c++-common/Wuse-after-free-7.c: New test. * c-c++-common/Wuse-after-free.c: New test. * g++.dg/warn/Wmismatched-dealloc-3.C: New test. * g++.dg/warn/Wuse-after-free.C: New test.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-01-04Update copyright years.Jakub Jelinek1-2/+1
From-SVN: r244052
2016-11-04libiberty: Fix -Wimplicit-fallthrough warnings.Mark Wielaard1-2/+6
Adjust some comments, add some explicit fall through comments or explicit returns where necessary to not get implicit-fallthrough warnings. All fall throughs were deliberate. In one case I added an explicit return false for clarity instead of falling through a default case (that also would return false). libiberty/ChangeLog: * cplus-dem.c (demangle_signature): Move fall through comment. (demangle_fund_type): Add fall through comment between 'G' and 'I'. * hashtab.c (iterative_hash): Add fall through comments. * regex.c (regex_compile): Add Fall through comment after '+'/'?'. (byte_re_match_2_internal): Add Fall through comment after jump_n. Change "Note fall through" to "Fall through". (common_op_match_null_string_p): Return false after set_number_at instead of fall through. From-SVN: r241864
2015-12-21re PR other/66827 (left shifts of negative value warnings due to C++14 switch)Nick Clifton1-1/+1
PR 66827 * regex.c (EXTRACT_NUMBER): Cast sign byte to unsigned before left shifting. From-SVN: r231873
2014-03-13* regex.c (bzero) [!_LIBC]: Cast the call to memcpy to (void).Uros Bizjak1-1/+1
From-SVN: r208558
2014-03-13regex.c (bzero): Define without coma expression.Uros Bizjak1-3/+3
* regex.c (bzero) [!_LIBC]: Define without coma expression. (regerror): Cast the call to memcpy to (void) to avoid unused value warnings. From-SVN: r208553
2013-07-22Fix typo.Mike Stump1-1/+1
From-SVN: r201139
2013-07-21Fix.Mike Stump1-1/+1
From-SVN: r201102
2013-02-09re PR other/56245 (-fsanitize=address miscompiles GCC)Jakub Jelinek1-4/+6
PR other/56245 * regex.c (PTR_INT_TYPE): Define. (EXTEND_BUFFER): Change incr type from int to PTR_INT_TYPE. From-SVN: r195918
2011-04-20remove useless if-before-free testsJim Meyering1-7/+4
Change "if (E) free (E);" to "free (E);" everywhere except in the libgo/, intl/, zlib/ and classpath/ directories. Also transform equivalent variants like "if (E != NULL) free (E);" and allow an extra cast on the argument to free. Otherwise, the tested and freed "E" expressions must be identical, modulo white space. From-SVN: r172785
2010-04-07tree-ssa-pre.c (my_rev_post_order_compute): Remove set but not used count ↵Jakub Jelinek1-3/+3
variable. * tree-ssa-pre.c (my_rev_post_order_compute): Remove set but not used count variable. * genemit.c (gen_expand, gen_split): Avoid set but not used warnings when operandN variables aren't used in the body of the expander or splitter. * tree-outof-ssa.c (FOR_EACH_ELIM_GRAPH_SUCC, FOR_EACH_ELIM_GRAPH_PRED): Avoid set but not used warnings. * tree-ssa-operands.h (FOR_EACH_SSA_TREE_OPERAND): Likewise. * tree-flow.h (FOR_EACH_IMM_USE_FAST, FOR_EACH_IMM_USE_STMT, FOR_EACH_IMM_USE_ON_STMT): Likewise. * tree.h (FOR_EACH_CONSTRUCTOR_ELT): Likewise. * tree.c (PROCESS_ARG): Likewise. fortran/ * parse.c (parse_derived, parse_enum): Avoid set but not used warning. java/ * expr.c (process_jvm_instruction): Avoid set but not used warning. * builtins.c (compareAndSwapInt_builtin, compareAndSwapLong_builtin, getVolatile_builtin): Likewise. libjava/ * exception.cc (_Jv_Throw): Avoid set but not used warning. * include/java-assert.h (JvAssertMessage, JvAssert): Use argument in sizeof to avoid set but not used warnings. libjava/classpath/ * native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c (Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1): Avoid set but not used warning. libiberty/ * regex.c (byte_re_match_2_internal): Avoid set but not used warning. gcc/testsuite/ * gcc.dg/builtin-choose-expr.c: Avoid set but not used warnings. * gcc.dg/trunc-1.c: Likewise. * gcc.dg/vla-9.c: Likewise. * gcc.dg/dfp/composite-type.c: Likewise. libffi/ * testsuite/libffi.call/err_bad_abi.c: Remove unused args variable. From-SVN: r158084
2009-10-01regex.c (byte_re_match_2_internal): Split declaration and assignment to ↵Martin Thuresson1-2/+5
avoid -Wc++-compat warning due to goto. 2009-09-30 Martin Thuresson <martint@google.com> * regex.c (byte_re_match_2_internal): Split declaration and assignment to avoid -Wc++-compat warning due to goto. From-SVN: r152354
2005-07-22* regex.c (regcomp): Change type of `i' from unsigned to int.Ben Elliston1-2/+2
From-SVN: r102270
2005-07-15* regex.c (TRANSLATE): Cast rhs of ternary expression to char.Ben Elliston1-2/+4
From-SVN: r102050
2005-07-12pexecute.c (pexecute): Cast string litrals to char *.Ben Elliston1-1/+1
* pexecute.c (pexecute): Cast string litrals to char *. * regex.c (re_comp): Cast a call to gettext() to char *. From-SVN: r101911
2005-05-10Update the address and phone number of the FSF organization.Nick Clifton1-2/+2
From-SVN: r99519
2005-04-13Fix missed replacements.Gabriel Dos Reis1-2/+2
From-SVN: r98063
2005-04-13regex.c (wcs_re_match_2_internal, [...]): Replace not with negate.Gabriel Dos Reis1-8/+8
* regex.c (wcs_re_match_2_internal, byte_re_match_2_internal): Replace not with negate. From-SVN: r98062
2005-03-28xregex2.h (_RE_ARGS): Remove definition and uses.Gabriel Dos Reis1-291/+170
include/ 2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net> * xregex2.h (_RE_ARGS): Remove definition and uses. libiberty/ 2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net> Convert libiberty to use ISO C prototype style 7/n. * regex.c (PARAMS): Remove definition. (PREFIX): Unconditionaly define using ISO C ## operator. (init_syntax_once, extract_number, extract_number_and_incr, print_fastmap, print_partial_compiled_pattern, print_compiled_pattern, print_double_string, printchar, convert_mbs_to_wcs, re_set_syntax, regex_grow_registers, regex_compile, store_op1, store_op2, insert_op1, insert_op2, at_begline_loc_p, at_endline_p, group_in_compile_stack, insert_space, wcs_compile_range, byte_compile_range, truncate_wchar, re_compile_fastmap, re_compile_fastmap, re_set_registers, re_search, re_search_2, re_search_3, re_match, re_match_2, count_mbs_length, wcs_re_match_2_internal, byte_re_match_2_internal, group_match_null_string_p, alt_match_null_string_p, common_op_match_null_string_p, bcmp_translate, re_compile_pattern, re_comp, re_exec, regcomp, regexec, regerror, regfree): Use ISO C prototype style. * partition.c: (elem_compare): Likewise. * cp-demangle.c (print_usage): Likewise. From-SVN: r97129
2004-11-20objalloc.c, [...]: Include "config.h" before "ansidecl.h" to avoid ↵Roger Sayle1-2/+4
redeclaration errors with... * objalloc.c, strsignal.c, xstrerror.c: Include "config.h" before "ansidecl.h" to avoid redeclaration errors with native compilers. * regex.c: Protect config.h from multiple inclusion. From-SVN: r90954
2004-02-17regex.c: Include <ansidecl.h>.Matt Kraai1-2/+4
* regex.c: Include <ansidecl.h>. (regcomp): Cast i to int. (regerror): Add ATTRIBUTE_UNUSED to parameter preg. From-SVN: r77944
2003-04-15re PR target/10338 ([3.3 regression?] [Cygwin -> tic4x | avr] cross target ↵Kaveh R. Ghazi1-1/+1
compilation error) gcc: PR target/10338 PR bootstrap/10198 PR bootstrap/10140 * fixinc/gnu-regex.c (regerror): Use mempcpy not __mempcpy. libiberty: PR target/10338 PR bootstrap/10198 PR bootstrap/10140 * getopt.c (exchange, _getopt_initialize): Use mempcpy not __mempcpy. * regex.c (regerror): Likewise. From-SVN: r65634
2002-09-20cp-demangle.c (demangling_new): Cast 0 to enum.John David Anglin1-1/+1
* cp-demangle.c (demangling_new): Cast 0 to enum. (demangle_char): Cast return of strdup to char *. (is_gnu_v3_mangled_ctor): Cast 0 to enum. (is_gnu_v3_mangled_dtor): Likewise. * cplus-dem.c (grow_vect): Cast return of xrealloc to void *. (work_stuff_copy_to_from): Cast return of xmalloc to char **. * fibheap.c (fibnode_new): Cast return of xcalloc to fibnode_t. * md5.c (md5_process_bytes): Cast results back to const void *. (md5_process_block): Add cast to const md5_uint32 *. * regex.c (re_compile_fastmap): Cast enum to UCHAR_T. * safe-ctype.c (L, XL, U, XU, D, P, _, C, Z, M, V, T, S): Add cast to unsigned short. * splay-tree.c (splay_tree_xmalloc_allocate): Cast return of xmalloc to void *. * vasprintf.c (int_vasprintf): Cast return of malloc to char *. From-SVN: r57330
2002-09-05* regex.c: Only use "#pragma alloca" on AIX when not using gcc.Roger Sayle1-1/+1
From-SVN: r56871
2002-08-07regex.c (re_error_msgid): Just use a simple array of strings.DJ Delorie1-81/+25
* regex.c (re_error_msgid): Just use a simple array of strings. (re_compile_pattern): Compensate. (re_comp): Likewise. (re_comp): Likewise. (regerror): Likewise. From-SVN: r56106
2001-11-16Update test for token pasting to also check "|| defined(ALMOST_STDC)"Kaveh R. Ghazi1-2/+2
From-SVN: r47108
2001-11-16regex.c: Check defined(__STDC__) || defined(HAVE_STRINGIZE) to determine ↵Kaveh R. Ghazi1-2/+2
whether ISO CPP... * regex.c: Check defined(__STDC__) || defined(HAVE_STRINGIZE) to determine whether ISO CPP token pasting is available. From-SVN: r47107
2001-11-15config.in (HAVE_UINTPTR_T): Provide autoconf stub.Jeffrey A Law1-1/+1
* config.in (HAVE_UINTPTR_T): Provide autoconf stub. * configure.in (HAVE_UINTPTR_T): Test for system defining uintptr_t and define HAVE_UINTPTR_T appropriately. * regex.c (uintptr_t): Do not provide a definition if the system provided one. From-SVN: r47068
2001-11-15regex.c (PREFIX): Provide an alternate definition for non-ANSI/ISO compilers.Jeffrey A Law1-3/+12
* regex.c (PREFIX): Provide an alternate definition for non-ANSI/ISO compilers. (ARG_PREFIX): Likewise. From-SVN: r47067
2001-11-12obstack.c (_): Honor the setting of ENABLE_NLS.Jim Meyering1-1/+1
2001-11-12 Jim Meyering <meyering@lucent.com> * obstack.c (_): Honor the setting of ENABLE_NLS. Otherwise, this code would end up calling gettext even in packages built with --disable-nls. * getopt.c (_): Likewise. * regex.c (_): Likewise. From-SVN: r46975
2001-08-23merge from glibcUlrich Drepper1-14/+58
From-SVN: r45134
2001-08-12backport: regex.c (wcs_regex_compile): Use appropriate string to compare ↵Isamu Hasegawa1-2/+2
with collating element. Merge from libc: * regex.c (wcs_regex_compile): Use appropriate string to compare with collating element. Fix the padding for the alignment. From-SVN: r44838
2001-07-30backport: regex.c: Declare wcs functions only if compiling with MBS_SUPPORT.Andreas Jaeger1-46/+107
Merge from glibc: * regex.c: Declare wcs functions only if compiling with MBS_SUPPORT. Don't use #elif for traditional C. * regex.c: Revamp memory allocation for WCHAR functions to not use too much stack. From-SVN: r44471
2001-07-18merge from glibcDJ Delorie1-10/+24
From-SVN: r44138
2001-07-10Makefile.in: Add support for regex code.Jeff Johnston1-0/+8245
* Makefile.in: Add support for regex code. * regex.c: New file. From-SVN: r43914