Skip to content

Commit

Permalink
idt: use constexpr for constants
Browse files Browse the repository at this point in the history
Use `constexpr` for constants to prevent the compiler from generating
an external reference under all circumstances.

Fixes a build error with gcc-9 complaining that Idt::_idt_max is an
undefined reference in jdb_kern_info-ia32.o.

Change-Id: I756f0bcbb543cd20800767da121d85e385876017
  • Loading branch information
Frank Mehnert authored and jermar committed Oct 30, 2024
1 parent cf9e340 commit d7ff9b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/kern/ia32/idt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class Idt
friend class Jdb_kern_info_bench;

public:
static const unsigned _idt_max = FIASCO_IDT_MAX;
static constexpr unsigned _idt_max = FIASCO_IDT_MAX;

private:
static const Address _idt = Mem_layout::Idt;
static constexpr Address _idt = Mem_layout::Idt;
static Address _idt_pa;
};

Expand Down

0 comments on commit d7ff9b5

Please sign in to comment.