Missing gcc __builtin_stdc_bit_width/floor/ceil signature makes intellisense wrongly report error 70

Open Beginner friendly
#14,874 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
66/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
c, typescript

Research direction

Reproduce with the C snippet in the report (compiles cleanly under gcc/clang with -std=c23) and confirm the three __builtin_stdc_bit_* calls get squiggled with error 70. Then find the table where the extension declares the other __builtin_* signatures and add the missing entries, matching the argument and return types in the linked gcc Bit-Operation Builtins docs. Done means the repro file shows no IntelliSense error and the calls resolve to int.

Written by the indexing model from the issue text.

Description

Environment

OS and Version: Linux 7.2.14-arch1-1
VS Code Version: 1.145.2
C/C++ Extension Version: v1.35.6

Bug Summary and Steps to Reproduce

Bug Summary:
The signatures of the following 3 gcc builtin functions are missing:

  • __builtin_stdc_bit_width()
  • __builtin_stdc_bit_floor()
  • __builtin_stdc_bit_ceil()
    And when used in code, intellisense shows an error: incomplete type "void" is not allowed (C/C++ 70) despite the code being valid.

Steps to reproduce:
Open a vscode instance, and create the following file:

#include <stdio.h>

int main(){
	unsigned int x = 0x7000;

	printf("%d\n", __builtin_stdc_bit_width(x));
	printf("%d\n", __builtin_stdc_bit_floor(x));
	printf("%d\n", __builtin_stdc_bit_ceil(x));

	return 0;
}

The error squiggles appear directly, even though you can compile and run just fine: gcc -Wall -Wextra -std=c23 test.c -o test && ./test (works with clang too)
The builtin are described by the gcc documentation here

Configuration and Logs
None
Other Extensions

No response

Additional context

No response

Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
12

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode-cpptools

All issues in microsoft/vscode-cpptools

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.