Bug 194523

Summary: x11/nvidia-driver: nvidia_sysctl.c:38:5: error: static_assert failed "compile-time assertion failed" SYSCTL_ADD_STRING(&sysctl_ctx,
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Alexey Dokuchaev <danfe>
Status: Closed FIXED    
Severity: Affects Only Me CC: hselasky
Priority: --- Keywords: patch
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
fix none

Description Jan Beich freebsd_committer freebsd_triage 2014-10-22 03:38:16 UTC
Created attachment 148557 [details]
fix

Looks to be a fallout from base r273377. Dynamic sysctl macros (or any non-custom) already add correct CTLTYPE_*. The newly added CTASSERT chokes on overspecifying e.g.,

  --- nvidia_sysctl.o ---
  nvidia_sysctl.c:38:5: error: static_assert failed "compile-time assertion failed"
      SYSCTL_ADD_STRING(&sysctl_ctx,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  @/sys/sysctl.h:303:2: note: expanded from macro 'SYSCTL_ADD_STRING'
          CTASSERT(((access) & CTLTYPE) == 0);                            \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  @/sys/systm.h:102:21: note: expanded from macro 'CTASSERT'
  #define CTASSERT(x)     _Static_assert(x, "compile-time assertion failed")
                          ^              ~
  nvidia_sysctl.c:259:5: error: static_assert failed "compile-time assertion failed"
      SYSCTL_ADD_UINT(&sc->sysctl_ctx,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  @/sys/sysctl.h:338:2: note: expanded from macro 'SYSCTL_ADD_UINT'
          CTASSERT(((access) & CTLTYPE) == 0);                            \
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  @/sys/systm.h:102:21: note: expanded from macro 'CTASSERT'
  #define CTASSERT(x)     _Static_assert(x, "compile-time assertion failed")
                          ^              ~
  2 errors generated.
  *** [nvidia_sysctl.o] Error code 1

Tested only on nvidia-driver-343.22. The patch also contains OSVERSION check for imminent MFC to /stable/10.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-10-22 03:38:16 UTC
Auto-assigned to maintainer danfe@FreeBSD.org
Comment 2 Hans Petter Selasky freebsd_committer freebsd_triage 2014-10-22 06:17:24 UTC
Comment on attachment 148557 [details]
fix

Your patch is correct. You don't actually need the OS check.

--HPS
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2014-10-22 06:33:24 UTC
It might also be possible that I can allow in the kernel, that only invalid overspecifier will trigger an CTASSERT(). What do you think?

--HPS
Comment 4 commit-hook freebsd_committer freebsd_triage 2014-10-22 07:17:37 UTC
A commit references this bug:

Author: hselasky
Date: Wed Oct 22 07:16:47 UTC 2014
New revision: 273455
URL: https://svnweb.freebsd.org/changeset/base/273455

Log:
  Allow overspecification of SYSCTL type in external kernel modules.

  PR:		194523
  MFC after:	3 days

Changes:
  head/sys/sys/sysctl.h
Comment 5 Hans Petter Selasky freebsd_committer freebsd_triage 2014-10-22 07:28:09 UTC
Please re-open if still an issue.

Thank you!

--HPS