Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 853
    • Issues 853
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 41
    • Merge requests 41
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Issues
  • #2344
Closed
Open
Issue created Mar 03, 2021 by Aleksandr Mezin@amezinContributor

c_std=c11: gbitlock.c: ‘asm’ undeclared

Accidentally I configured glib with -Dc_std=c11 instead of -Dc_std=gnu11 (is it a supported configuration?) and got this failure:

[4/1220] Compiling C object glib/libglib-2.0.so.0.6705.0.p/gbitlock.c.o
FAILED: glib/libglib-2.0.so.0.6705.0.p/gbitlock.c.o 
ccache cc -Iglib/libglib-2.0.so.0.6705.0.p -Iglib -I../glib -I. -I.. -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -O2 -g -D_GNU_SOURCE -fno-strict-aliasing -DG_ENABLE_DEBUG -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wstrict-prototypes -Wunused -Wno-unused-parameter -Wno-bad-function-cast -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Werror=declaration-after-statement -Werror=format=2 -Werror=implicit-function-declaration -Werror=init-self -Werror=missing-include-dirs -Werror=missing-prototypes -Werror=pointer-arith -fPIC -pthread '-DG_LOG_DOMAIN="GLib"' -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/libglib-2.0.so.0.6705.0.p/gbitlock.c.o -MF glib/libglib-2.0.so.0.6705.0.p/gbitlock.c.o.d -o glib/libglib-2.0.so.0.6705.0.p/gbitlock.c.o -c ../glib/gbitlock.c
../glib/gbitlock.c: In function ‘g_bit_unlock’:
../glib/gbitlock.c:325:3: error: ‘asm’ undeclared (first use in this function)
  325 |   asm volatile ("lock btr %1, (%0)"
      |   ^~~
../glib/gbitlock.c:325:3: note: each undeclared identifier is reported only once for each function it appears in
../glib/gbitlock.c:325:6: error: expected ‘;’ before ‘volatile’
  325 |   asm volatile ("lock btr %1, (%0)"
      |      ^~~~~~~~~
      |      ;
../glib/gbitlock.c: In function ‘g_pointer_bit_lock’:
../glib/gbitlock.c:408:5: error: ‘asm’ undeclared (first use in this function)
  408 |     asm volatile goto ("lock bts %1, (%0)\n"
      |     ^~~
../glib/gbitlock.c:408:8: error: expected ‘;’ before ‘volatile’
  408 |     asm volatile goto ("lock bts %1, (%0)\n"
      |        ^~~~~~~~~
      |        ;
../glib/gbitlock.c:416:2: warning: label ‘contended’ defined but not used [-Wunused-label]
  416 |  contended:
      |  ^~~~~~~~~
../glib/gbitlock.c: In function ‘g_pointer_bit_trylock’:
../glib/gbitlock.c:480:5: error: ‘asm’ undeclared (first use in this function)
  480 |     asm volatile ("lock bts %2, (%1)\n"
      |     ^~~
../glib/gbitlock.c:480:8: error: expected ‘;’ before ‘volatile’
  480 |     asm volatile ("lock bts %2, (%1)\n"
      |        ^~~~~~~~~
      |        ;
../glib/gbitlock.c: In function ‘g_pointer_bit_unlock’:
../glib/gbitlock.c:523:5: error: ‘asm’ undeclared (first use in this function)
  523 |     asm volatile ("lock btr %1, (%0)"
      |     ^~~
../glib/gbitlock.c:523:8: error: expected ‘;’ before ‘volatile’
  523 |     asm volatile ("lock btr %1, (%0)"
      |        ^~~~~~~~~
      |        ;

g_bit_lock and g_bit_trylock use __asm__ instead of asm and seem to compile fine.

I guess 2330f7e6 was incomplete?

Assignee
Assign to
Time tracking