Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • QEMU QEMU
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 795
    • Issues 795
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Insights
    • Issue
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • QEMUQEMU
  • QEMUQEMU
  • Issues
  • #1541
Closed
Open
Issue created Mar 13, 2023 by SWW13@SWW13

Invalid position of G_NORETURN in clang v15

Host environment

  • Operating system: Arch Linux
  • OS/kernel version: Linux $HOST 6.2.5-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sat, 11 Mar 2023 14:28:15 +0000 x86_64 GNU/Linux
  • Architecture: x86_64
  • QEMU flavor: qemu-system-mipsel
  • QEMU version: v7.1.0 / master

Description of problem

Order of G_NORETURN used in https://gitlab.com/qemu-project/qemu/-/blob/0f3de970febd2c9b29dccecb63ca928c6802a101/include/qemu/osdep.h#L240-242 is not valid in clang++ 15.0.7.

Switching extern with G_NORETURN seems to fix the issue.

Steps to reproduce

  1. Build qemu system for MIPSEL or use minimal reproducer:

example.cpp:

#include "/path/to/qemu/include/glib-compat.h"

extern G_NORETURN
void // QEMU_ERROR("code path is reachable")
    qemu_build_not_reached_always(void);
$ clang++ --version
clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ clang++ -m64 -mcx16 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -fcolor-diagnostics -Wall -Winvalid-pch -std=gnu++11 -O0 -g example.cpp
example.cpp:3:8: error: an attribute list cannot appear here
extern G_NORETURN
       ^~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:1075:21: note: expanded from macro 'G_NORETURN'
# define G_NORETURN [[noreturn]]
                    ^~~~~~~~~~~~
1 error generated.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking