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

Default cStandard is incorrectly c11 instead of gnu18 when the default compiler is gcc #5834

Closed
minecraft2048 opened this issue Jul 25, 2020 · 4 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Milestone

Comments

@minecraft2048
Copy link

Type: LanguageService

Describe the bug

  • OS and Version: Ubuntu 20.04 LTS
  • VS Code Version:Version: 1.46.1
  • C/C++ Extension Version: v0.29.0
  • CRTSCTS from termios.h is squiggled with identifier "CRTSCTS" is undefined but it can compile on gcc without any problems

Steps to reproduce

  1. Enter this source file:
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>

struct termios tty;
int main(){
    tty.c_cflag &= ~CRTSCTS;
    printf("hello");
}

  1. Try compiling the code with gcc -o test2 test2.c and observe that the code compiles and run just fine
  2. CRTSCTS is squiggled with identifier "CRTSCTS" is undefined but that code can compile in gcc just fine

Expected behavior

CRTSCTS is not squiggled

Logs

Log Diagnostics: https://gist.github.com/minecraft2048/764f72423659df3c1c33c8b21c4136d0
Language server log: https://gist.github.com/minecraft2048/70006e0791459f875d40dc47a1876a6e

@minecraft2048 minecraft2048 changed the title CRTSCTS from termios.h is squiggled with identifier "CRTSCTS" is undefined but it can compile on gcc without any problems CRTSCTS from termios.h is squiggled with identifier "CRTSCTS" is undefined but it can compile on gcc without any problems Jul 25, 2020
@minecraft2048 minecraft2048 changed the title CRTSCTS from termios.h is squiggled with identifier "CRTSCTS" is undefined but it can compile on gcc without any problems CRTSCTS from termios.h is squiggled with 'identifier "CRTSCTS" is undefined' but it can compile on gcc without any problems Jul 25, 2020
@sean-mcmanus sean-mcmanus self-assigned this Jul 27, 2020
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Jul 27, 2020

Change your cStandard property to gnu11 to fix the issue

            "cStandard": "gnu11",

Let us know if you think there's a bug with the default cStandard not being set correctly (I think it should be gnu11 by default if we detect a gcc compiler by default).

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Jul 27, 2020

Yeah, I just reproed a bug where cStandard is being set to c11 by default instead of gnu11 (cppStandard is correctly gnu++14).

@sean-mcmanus sean-mcmanus changed the title CRTSCTS from termios.h is squiggled with 'identifier "CRTSCTS" is undefined' but it can compile on gcc without any problems Default cStandard is incorrectly c11 instead of gnu11 when the default compiler is gcc Jul 27, 2020
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Jul 27, 2020

The bug repros when the compiler reports __STDC_VERSION__ 201710L. Should be trivial to fix. The default of gnu18 should be used (we were only handling the case where the compiler reported a 2018 version).

@sean-mcmanus sean-mcmanus added this to the 0.30.0 milestone Jul 27, 2020
@sean-mcmanus sean-mcmanus changed the title Default cStandard is incorrectly c11 instead of gnu11 when the default compiler is gcc Default cStandard is incorrectly c11 instead of gnu18 when the default compiler is gcc Jul 27, 2020
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Jul 27, 2020
@sean-mcmanus sean-mcmanus removed their assignment Jul 27, 2020
@sean-mcmanus
Copy link
Contributor

@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Projects
None yet
Development

No branches or pull requests

2 participants