Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outline for C99/11 with Clang/GCC gets confused - incorrect additional entries #53670

Closed
runelabs opened this issue Jul 6, 2018 · 4 comments
Closed
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) outline Source outline view issues

Comments

@runelabs
Copy link

runelabs commented Jul 6, 2018

  • VSCode Version: 1.25.0 x64 2018-07-05T13:10:37.273Z ( 0f080e5 )
  • OS Version: Linux
  • Microsoft C/C++ IntelliSense - Version 0.17.6: July 2, 2018
  • clang version 6.0.0 , gcc 7.3.0

Steps to Reproduce:

  1. The outline view shows several incorrect entries - local function variables and other calls from within function bodies.
  2. It seems to be triggered by the Clang and GCC C language extension for compound expressions.
    I imagine there is similar incorrect behaviour for Clang blocks.
    -- https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Statement-Exprs.html
    -- https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Naming-Types.html
    -- https://en.wikipedia.org/wiki/Blocks_(C_language_extension)
    -- https://clang.llvm.org/docs/BlockLanguageSpec.html
  3. See the confused outline view for the following example code
#include <stdarg.h>
#include <string.h>

#define noing __attribute__((noinline))
#define fn() 
#define success() 0

typedef struct {int a; int b; char* s; int c;} Some;    // weird entry in outline

noing void foo(unsigned int len, int argc,...) {  // note: change signature -> no outline update
  fn();
  int list[argc];
  Some* p = &list[0];
  va_list argp;
  va_start(argp, argc);
  for (int k=0;k!=argc;++k) {
    *p = ({Some tmp = {1, 2, &"", 2}; tmp;}); // compound expression likely culprit
  }
  va_end(argp);                       // va_end  incorrectly shown in outline
  int k = 0;                          // k incorrectly shown in outline
  while (len != 0) {
    if (!success()) {
      register int r = len -1;
      if (k>0) memmove(&list[k],&list[k+1],r*sizeof(int)); // memmove shows in outline
      len--;
    }
    fn();                             // fn incorrectly shown in outline
  }
}

Does this issue occur when all extensions are disabled?: Yes

@vscodebot
Copy link

vscodebot bot commented Jul 6, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@jrieken jrieken self-assigned this Jul 6, 2018
@jrieken jrieken added info-needed Issue requires more information from poster outline Source outline view issues labels Jul 6, 2018
@jrieken
Copy link
Member

jrieken commented Jul 6, 2018

@runelabs What extension are you using for clang?

@runelabs
Copy link
Author

runelabs commented Jul 6, 2018

@jrieken
Using Microsoft C/C++ IntelliSense - Version 0.17.6: July 2, 2018

@jrieken jrieken removed the info-needed Issue requires more information from poster label Jul 6, 2018
@jrieken
Copy link
Member

jrieken commented Jul 6, 2018

Ok, thanks. The issue is that the extension needs to adopt some new API. I have created microsoft/vscode-cpptools#2230 for them and I am closing this as duplicate

@jrieken jrieken closed this as completed Jul 6, 2018
@jrieken jrieken added the *duplicate Issue identified as a duplicate of another issue(s) label Jul 6, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) outline Source outline view issues
Projects
None yet
Development

No branches or pull requests

2 participants