Skip to content
  1. Feb 14, 2009
    • Chris Lattner's avatar
      fix rdar://6586493, a bug in codegen of the GNU · cd7bc144
      Chris Lattner authored
      missing-?:-true-value extension.
      
      llvm-svn: 64505
      cd7bc144
    • Douglas Gregor's avatar
      Implicitly declare certain C library functions (malloc, strcpy, memmove, · b9063fc1
      Douglas Gregor authored
      etc.) when we perform name lookup on them. This ensures that we
      produce the correct signature for these functions, which has two
      practical impacts:
      
        1) When we're supporting the "implicit function declaration" feature
        of C99, these functions will be implicitly declared with the right
        signature rather than as a function returning "int" with no
        prototype. See PR3541 for the reason why this is important (hint:
        GCC always predeclares these functions).
       
        2) If users attempt to redeclare one of these library functions with
        an incompatible signature, we produce a hard error.
      
      This patch does a little bit of work to give reasonable error
      messages. For example, when we hit case #1 we complain that we're
      implicitly declaring this function with a specific signature, and then
      we give a note that asks the user to include the appropriate header
      (e.g., "please include <stdlib.h> or explicitly declare 'malloc'"). In
      case #2, we show the type of the implicit builtin that was incorrectly
      declared, so the user can see the problem. We could do better here:
      for example, when displaying this latter error message we say
      something like:
      
        'strcpy' was implicitly declared here with type 'char *(char *, char
        const *)'
      
      but we should really print out a fake code line showing the
      declaration, like this:
      
        'strcpy' was implicitly declared here as:
      
          char *strcpy(char *, char const *)
      
      This would also be good for printing built-in candidates with C++
      operator overloading.
      
      The set of C library functions supported by this patch includes all
      functions from the C99 specification's <stdlib.h> and <string.h> that
      (a) are predefined by GCC and (b) have signatures that could cause
      codegen issues if they are treated as functions with no prototype
      returning and int. Future work could extend this set of functions to
      other C library functions that we know about.
      
      llvm-svn: 64504
      b9063fc1
  2. Feb 13, 2009
  3. Feb 12, 2009
  4. Feb 11, 2009
Loading